Skip to content

Commit beb5720

Browse files
ragoandi34
authored andcommitted
Fix potential overflow in Visualizer effect
Bug: 30229821 Change-Id: Idd3c1563dc9d3261e6e168e945005bf133ab2cdb (cherry picked from commit 099ab28) (cherry picked from commit 46dc714)
1 parent 2b488eb commit beb5720

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

media/libeffects/visualizer/EffectVisualizer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <time.h>
2525
#include <math.h>
2626
#include <audio_effects/effect_visualizer.h>
27+
#include <cutils/log.h>
2728

2829

2930
extern "C" {
@@ -597,6 +598,14 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
597598
break;
598599

599600
case VISUALIZER_CMD_MEASURE: {
601+
if (pReplyData == NULL || replySize == NULL ||
602+
*replySize < (sizeof(int32_t) * MEASUREMENT_COUNT)) {
603+
ALOGV("VISUALIZER_CMD_MEASURE() error *replySize %" PRIu32
604+
" < (sizeof(int32_t) * MEASUREMENT_COUNT) %" PRIu32, *replySize,
605+
sizeof(int32_t) * MEASUREMENT_COUNT);
606+
android_errorWriteLog(0x534e4554, "30229821");
607+
return -EINVAL;
608+
}
600609
uint16_t peakU16 = 0;
601610
float sumRmsSquared = 0.0f;
602611
uint8_t nbValidMeasurements = 0;

0 commit comments

Comments
 (0)