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

Commit 29ee1e9d authored by Wonsik Kim's avatar Wonsik Kim Committed by Michael Bestas
Browse files

DO NOT MERGE codecs: check OMX buffer size before use in (gsm|g711)dec

Bug: 27793163
Bug: 27793367
Change-Id: Iec3de8a237ee2379d87a8371c13e543878c6652c
(cherry picked from commit 0490fe25)
parent 9cf2c18a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -218,6 +218,15 @@ void SoftG711::onQueueFilled(OMX_U32 portIndex) {
            mSignalledError = true;
        }

        if (inHeader->nFilledLen * sizeof(int16_t) > outHeader->nAllocLen) {
            ALOGE("output buffer too small (%d).", outHeader->nAllocLen);
            android_errorWriteLog(0x534e4554, "27793163");

            notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
            mSignalledError = true;
            return;
        }

        const uint8_t *inputptr = inHeader->pBuffer + inHeader->nOffset;

        if (mIsMLaw) {
+8 −0
Original line number Diff line number Diff line
@@ -213,6 +213,14 @@ void SoftGSM::onQueueFilled(OMX_U32 portIndex) {
            mSignalledError = true;
        }

        if (outHeader->nAllocLen < (inHeader->nFilledLen / 65) * 320) {
            ALOGE("output buffer is not large enough (%d).", outHeader->nAllocLen);
            android_errorWriteLog(0x534e4554, "27793367");
            notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
            mSignalledError = true;
            return;
        }

        uint8_t *inputptr = inHeader->pBuffer + inHeader->nOffset;

        int n = mSignalledError ? 0 : DecodeGSM(mGsm,