summaryrefslogtreecommitdiffstats
path: root/media/libeffects
diff options
context:
space:
mode:
authorrago <rago@google.com>2016-08-22 17:20:26 -0700
committergitbuildkicker <android-build@google.com>2016-09-27 15:56:39 -0700
commit23ffe421812180b20043b8a108a72b2e95ef1f0c (patch)
treee3d91c3f7a91c73f8c6dbc1ede93725d2e05dc56 /media/libeffects
parentbc8a45f506a8be33250c523d71fab637a5fdaf81 (diff)
downloadframeworks_av-23ffe421812180b20043b8a108a72b2e95ef1f0c.zip
frameworks_av-23ffe421812180b20043b8a108a72b2e95ef1f0c.tar.gz
frameworks_av-23ffe421812180b20043b8a108a72b2e95ef1f0c.tar.bz2
Fix potential overflow in Visualizer effect
Bug: 30229821 Change-Id: Idd3c1563dc9d3261e6e168e945005bf133ab2cdb (cherry picked from commit 099ab280775946e7c36c73fde47f2ee5a2579f53) (cherry picked from commit 46dc714d523a41a4f886eecbe5b9947a4c900510)
Diffstat (limited to 'media/libeffects')
-rw-r--r--media/libeffects/visualizer/EffectVisualizer.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index 0c310c5..91f9fc7 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -25,6 +25,7 @@
#include <time.h>
#include <math.h>
#include <audio_effects/effect_visualizer.h>
+#include <cutils/log.h>
extern "C" {
@@ -599,6 +600,14 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
} break;
case VISUALIZER_CMD_MEASURE: {
+ if (pReplyData == NULL || replySize == NULL ||
+ *replySize < (sizeof(int32_t) * MEASUREMENT_COUNT)) {
+ ALOGV("VISUALIZER_CMD_MEASURE() error *replySize %" PRIu32
+ " < (sizeof(int32_t) * MEASUREMENT_COUNT) %" PRIu32, *replySize,
+ sizeof(int32_t) * MEASUREMENT_COUNT);
+ android_errorWriteLog(0x534e4554, "30229821");
+ return -EINVAL;
+ }
uint16_t peakU16 = 0;
float sumRmsSquared = 0.0f;
uint8_t nbValidMeasurements = 0;