summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-15 19:04:24 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-15 19:04:24 +0000
commitcbd50acd7f9696303850c48e4f34d206b2353bd7 (patch)
tree28bdc859f88afcdee24a0bd055d451e94c5b127f
parenta602e8b2af2cf9e9fe08793b3f778b4627ac6bad (diff)
parent440b3720fdd1d3e3986bf95b907447142900a974 (diff)
downloadaudio-nougat-mr2-pixel-release.tar.gz
Merge cherrypicks of [2413849, 2413760, 2413901, 2413776, 2413658, 2413792, 2413850, 2413851, 2413793, 2413866, 2413738, 2413659, 2413660, 2413867, 2413868, 2413885, 2413829, 2413814, 2413886, 2413921, 2413777, 2413887, 2413854, 2413889, 2413890, 2413855, 2413869, 2413740, 2413816, 2413831, 2413832, 2413817, 2413892, 2413797, 2413779] into nyc-mr2-pixel-monthly-releaseandroid-7.1.2_r29nougat-mr2-pixel-release
Change-Id: Ib1e73dde43e1c2aeb81b3f8dc95f011548aa3e45
-rw-r--r--post_proc/equalizer.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/post_proc/equalizer.c b/post_proc/equalizer.c
index 1cd40d2..8c9449a 100644
--- a/post_proc/equalizer.c
+++ b/post_proc/equalizer.c
@@ -364,6 +364,7 @@ int equalizer_set_parameter(effect_context_t *context, effect_param_t *p,
equalizer_context_t *eq_ctxt = (equalizer_context_t *)context;
int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
void *value = p->data + voffset;
+ int32_t vsize = (int32_t) p->vsize;
int32_t *param_tmp = (int32_t *)p->data;
int32_t param = *param_tmp++;
int32_t preset;
@@ -378,6 +379,10 @@ int equalizer_set_parameter(effect_context_t *context, effect_param_t *p,
switch (param) {
case EQ_PARAM_CUR_PRESET:
ALOGV("EQ_PARAM_CUR_PRESET");
+ if (vsize < sizeof(int16_t)) {
+ p->status = -EINVAL;
+ break;
+ }
preset = (int32_t)(*(uint16_t *)value);
if ((preset >= equalizer_get_num_presets(eq_ctxt)) || (preset < 0)) {
@@ -388,6 +393,10 @@ int equalizer_set_parameter(effect_context_t *context, effect_param_t *p,
break;
case EQ_PARAM_BAND_LEVEL:
ALOGV("EQ_PARAM_BAND_LEVEL");
+ if (vsize < sizeof(int16_t)) {
+ p->status = -EINVAL;
+ break;
+ }
band = *param_tmp;
level = (int32_t)(*(int16_t *)value);
if (band < 0 || band >= NUM_EQ_BANDS) {
@@ -402,6 +411,10 @@ int equalizer_set_parameter(effect_context_t *context, effect_param_t *p,
break;
case EQ_PARAM_PROPERTIES: {
ALOGV("EQ_PARAM_PROPERTIES");
+ if (vsize < sizeof(int16_t)) {
+ p->status = -EINVAL;
+ break;
+ }
int16_t *prop = (int16_t *)value;
if ((int)prop[0] >= equalizer_get_num_presets(eq_ctxt)) {
p->status = -EINVAL;
@@ -410,6 +423,13 @@ int equalizer_set_parameter(effect_context_t *context, effect_param_t *p,
if (prop[0] >= 0) {
equalizer_set_preset(eq_ctxt, (int)prop[0]);
} else {
+ if (vsize < (2 + NUM_EQ_BANDS) * sizeof(int16_t)) {
+ android_errorWriteLog(0x534e4554, "37563371");
+ ALOGE("\tERROR EQ_PARAM_PROPERTIES valueSize %d < %d",
+ vsize, (2 + NUM_EQ_BANDS) * sizeof(int16_t));
+ p->status = -EINVAL;
+ break;
+ }
if ((int)prop[1] != NUM_EQ_BANDS) {
p->status = -EINVAL;
break;