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

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

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

am: 2feb9ce7

Change-Id: I6a251c81d4337113a863a5364c39006678cca066
parents 87415a74 2feb9ce7
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;