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

Commit f11e95b2 authored by Marco Nelissen's avatar Marco Nelissen Committed by Abhishek Arya
Browse files

Check buffer size before using it

Bug: 21814993
Change-Id: Idaac61b4b9f4058b94e84093644593ba315d72ff
(cherry picked from commit c1a104aa)
parent 3ce29384
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -3193,6 +3193,10 @@ status_t MPEG4Source::read(
            CHECK(mBuffer == NULL);
            CHECK(mBuffer == NULL);
            return err;
            return err;
        }
        }
        if (size > mBuffer->size()) {
            ALOGE("buffer too small: %zu > %zu", size, mBuffer->size());
            return ERROR_BUFFER_TOO_SMALL;
        }
    }
    }


    if (!mIsAVC || mWantsNALFragments) {
    if (!mIsAVC || mWantsNALFragments) {
@@ -3439,6 +3443,10 @@ status_t MPEG4Source::fragmentedRead(
            ALOGV("acquire_buffer returned %d", err);
            ALOGV("acquire_buffer returned %d", err);
            return 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];
    const Sample *smpl = &mCurrentSamples[mCurrentSampleIndex];