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

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

Fix potential overflow in Visualizer effect

am: 57ac6634

Change-Id: I3c8e2f9ee860ac37dc53e9766f12d16f113e82e9
parents 0dac1009 57ac6634
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -824,6 +824,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;