Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53bc7fce authored by rago's avatar rago Committed by android-build-merger
Browse files

Fix potential overflow in Visualizer effect am: 46dc714d am: 8720f851 am:...

Fix potential overflow in Visualizer effect am: 46dc714d am: 8720f851 am: bad0250d am: 2feb9ce7 am: fba2bd13 am: dddfa37e am: de6acc18 am: a0f7a7b0 am: dd6ad5eb am: be0844b5
am: 0710743c

Change-Id: I142290d5735b028876eb9e5a974a4b0c8b910fef
parents 58bb33f4 0710743c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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;