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

Commit 6b3b2f26 authored by Harish Mahendrakar's avatar Harish Mahendrakar Committed by Bryan Ferris
Browse files

OpusHeader: Fix integer overflow in GetOpusHeaderBuffers

unified CSD parsing now checks for valid size of CSD

Bug: 142861738
Test: poc in bug
Test: atest android.media.cts.DecoderTest
Change-Id: Iff742d2fdf4139bab7b5f378c1742ef52c0bbc78
Merged-In: Iff742d2fdf4139bab7b5f378c1742ef52c0bbc78
parent 58cc8f2c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -292,6 +292,10 @@ bool GetOpusHeaderBuffers(const uint8_t *data, size_t data_size,
        *opusHeadSize = data_size;
        return true;
    } else if (memcmp(AOPUS_CSD_MARKER_PREFIX, data, AOPUS_CSD_MARKER_PREFIX_SIZE) == 0) {
        if (data_size < AOPUS_UNIFIED_CSD_MINSIZE || data_size > AOPUS_UNIFIED_CSD_MAXSIZE) {
            ALOGD("Unexpected size for unified opus csd %zu", data_size);
            return false;
        }
        size_t i = 0;
        bool found = false;
        while (i <= data_size - AOPUS_MARKER_SIZE - AOPUS_LENGTH_SIZE) {