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

Commit 6a8995e0 authored by Lajos Molnar's avatar Lajos Molnar Committed by Android (Google) Code Review
Browse files

Merge "Check buffer size before using it" into mnc-dev

parents 8ffab243 c1a104aa
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -4034,6 +4034,10 @@ status_t MPEG4Source::read(
            CHECK(mBuffer == NULL);
            return err;
        }
        if (size > mBuffer->size()) {
            ALOGE("buffer too small: %zu > %zu", size, mBuffer->size());
            return ERROR_BUFFER_TOO_SMALL;
        }
    }

    if ((!mIsAVC && !mIsHEVC) || mWantsNALFragments) {
@@ -4294,6 +4298,10 @@ status_t MPEG4Source::fragmentedRead(
            ALOGV("acquire_buffer returned %d", err);
            return err;
        }
        if (size > mBuffer->size()) {
            ALOGE("buffer too small: %zu > %zu", size, mBuffer->size());
            return ERROR_BUFFER_TOO_SMALL;
        }
    }

    const Sample *smpl = &mCurrentSamples[mCurrentSampleIndex];