summaryrefslogtreecommitdiffstats
path: root/audio_route
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2013-05-13 12:47:41 -0700
committerSimon Wilson <simonwilson@google.com>2013-05-13 12:52:53 -0700
commitd35bd63c74452b83eef34cff4f0831493d0781fa (patch)
tree38a2ea6ebb5548ec1d1cfdafe07413dd379d12fc /audio_route
parentc6b93d3dafa55f46bd9933ec8b1db45c309bf5a4 (diff)
downloadandroid_system_media-d35bd63c74452b83eef34cff4f0831493d0781fa.tar.gz
android_system_media-d35bd63c74452b83eef34cff4f0831493d0781fa.tar.bz2
android_system_media-d35bd63c74452b83eef34cff4f0831493d0781fa.zip
audio_route: skip missing controls
Mixer controls that are in mixer_paths.xml but missing from the mixer should be skipped, otherwise arrays will be accessed out of bounds. This happened in b/8893515. Also print the missing control name to aid debugging. Change-Id: Ia808df48734f78a02281408a4025652dec9762c0
Diffstat (limited to 'audio_route')
-rw-r--r--audio_route/audio_route.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/audio_route/audio_route.c b/audio_route/audio_route.c
index b935904e..da7585c0 100644
--- a/audio_route/audio_route.c
+++ b/audio_route/audio_route.c
@@ -405,6 +405,11 @@ static void start_tag(void *data, const XML_Char *tag_name,
else if (strcmp(tag_name, "ctl") == 0) {
/* Obtain the mixer ctl and value */
ctl = mixer_get_ctl_by_name(ar->mixer, attr_name);
+ if (ctl == NULL) {
+ ALOGE("Control '%s' doesn't exist - skipping", attr_name);
+ goto done;
+ }
+
switch (mixer_ctl_get_type(ctl)) {
case MIXER_CTL_TYPE_BOOL:
case MIXER_CTL_TYPE_INT:
@@ -464,6 +469,7 @@ static void start_tag(void *data, const XML_Char *tag_name,
}
}
+done:
state->level++;
}