Fix potential overflow in Visualizer effect

Bug: 30229821
Change-Id: Iea1c4a21735e893aeded95b980044ec0861a7ea8
(cherry picked from commit 2fa52194ef64843c2908c69527384c6c2fcdbafa)
(cherry picked from commit 57ac66340ad488a17fc285b6fc2635cb7375d72b)
(cherry picked from commit 9cb9810ecb63c8ff55ecf4bc77431dc5b0688b5f)
This commit is contained in:
rago 2016-08-22 17:59:38 -07:00 committed by Dennis Cagle
parent 3421e5c9a8
commit d8c80c2fb0
1 changed files with 8 additions and 0 deletions

View File

@ -896,6 +896,14 @@ int visualizer_command(effect_context_t * context, uint32_t cmdCode, uint32_t cm
break;
case VISUALIZER_CMD_MEASURE: {
if (pReplyData == NULL || replySize == NULL ||
*replySize < (sizeof(int32_t) * MEASUREMENT_COUNT)) {
ALOGV("%s VISUALIZER_CMD_MEASURE error *replySize %d <"
"(sizeof(int32_t) * MEASUREMENT_COUNT) %d",
__func__, *replySize, sizeof(int32_t) * MEASUREMENT_COUNT);
android_errorWriteLog(0x534e4554, "30229821");
return -EINVAL;
}
uint16_t peak_u16 = 0;
float sum_rms_squared = 0.0f;
uint8_t nb_valid_meas = 0;