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

Commit aa1cc741 authored by Jon Larimer's avatar Jon Larimer Committed by Android (Google) Code Review
Browse files

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

parents 6efa86be f11e95b2
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3202,6 +3202,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 || mWantsNALFragments) {
@@ -3448,6 +3452,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];