release-request-01b39c26-bf86-40a5-a7bf-8eb15c488673-for-git_oc-mr1-release-4080221 snap-temp-L23400000072087081

Change-Id: I48df2c1bed823abcb115f5b417fb32691c77cc97
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index e689b28..cca56ec 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3693,7 +3693,7 @@
 
     // power_log may be null if the format is not supported
     // or not a userdebug or eng build.
-    if (is_userdebug_or_eng_build()) {
+    if (false /* is_userdebug_or_eng_build() */) {
         const size_t POWER_LOG_FRAMES_PER_ENTRY =
                 (long long)config->sample_rate * POWER_LOG_SAMPLING_INTERVAL_MS / 1000;
 
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index 493f2cc..f1174a0 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -30,6 +30,8 @@
 	external/tinyalsa/include \
 	$(call include-path-for, audio-effects)
 
+LOCAL_HEADER_LIBRARIES += libhardware_headers
+LOCAL_HEADER_LIBRARIES += libsystem_headers
 include $(BUILD_SHARED_LIBRARY)
 endif
 
@@ -60,6 +62,8 @@
         hardware/qcom/audio/hal \
 	$(call include-path-for, audio-effects)
 
+LOCAL_HEADER_LIBRARIES += libhardware_headers
+LOCAL_HEADER_LIBRARIES += libsystem_headers
 include $(BUILD_SHARED_LIBRARY)
 
 endif
diff --git a/post_proc/equalizer.c b/post_proc/equalizer.c
index a8e5d1f..f7d6152 100644
--- a/post_proc/equalizer.c
+++ b/post_proc/equalizer.c
@@ -334,6 +334,13 @@
                 }
                 break;
         }
+
+        if (p->vsize < 1) {
+            p->status = -EINVAL;
+            android_errorWriteLog(0x534e4554, "37536407");
+            break;
+        }
+
         name = (char *)value;
         strlcpy(name, equalizer_get_preset_name(eq_ctxt, param2), p->vsize - 1);
         name[p->vsize - 1] = 0;
@@ -364,6 +371,7 @@
     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 +386,10 @@
     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 +400,10 @@
         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 +418,10 @@
         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 +430,13 @@
         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;
diff --git a/visualizer/Android.mk b/visualizer/Android.mk
index e318214..29a093e 100644
--- a/visualizer/Android.mk
+++ b/visualizer/Android.mk
@@ -36,4 +36,5 @@
 	external/tinyalsa/include \
 	$(call include-path-for, audio-effects)
 
+LOCAL_HEADER_LIBRARIES += libsystem_headers
 include $(BUILD_SHARED_LIBRARY)
diff --git a/voice_processing/Android.mk b/voice_processing/Android.mk
index e8878ee..7ebeb70 100644
--- a/voice_processing/Android.mk
+++ b/voice_processing/Android.mk
@@ -23,4 +23,5 @@
 
 LOCAL_CFLAGS += -fvisibility=hidden
 
+LOCAL_HEADER_LIBRARIES += libhardware_headers
 include $(BUILD_SHARED_LIBRARY)