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

Commit 8af2b9c7 authored by rago's avatar rago Committed by Gerrit - the friendly Code Review server
Browse files

Fix potential overflow in Visualizer effect

Bug: 30229821
Change-Id: Iea1c4a21735e893aeded95b980044ec0861a7ea8
(cherry picked from commit 2fa52194)
(cherry picked from commit 57ac6634)
(cherry picked from commit 9cb9810ecb63c8ff55ecf4bc77431dc5b0688b5f)
parent e61f451b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -892,6 +892,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;