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

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

Fix potential overflow in Visualizer effect am: 46dc714d

am: 8720f851

Change-Id: I0803632824e6fc5a70ad6a1ba36743eb11cc3e7e
parents dfe5b519 8720f851
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <time.h>
#include <math.h>
#include <audio_effects/effect_visualizer.h>
#include <cutils/log.h>


extern "C" {
@@ -597,6 +598,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;