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

Commit 2774f292 authored by Marco Nelissen's avatar Marco Nelissen Committed by android-build-merger
Browse files

Merge "Fix potential overflows" am: a0c1eb86

am: ef354234

Change-Id: I020bcf499ca455da44ff8eabcd867b44895eeb43
parents 668b1400 ef354234
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -305,8 +305,16 @@ status_t SampleIterator::findSampleTimeAndDuration(
        return ERROR_OUT_OF_RANGE;
    }

    while (sampleIndex >= mTTSSampleIndex + mTTSCount) {
        if (mTimeToSampleIndex == mTable->mTimeToSampleCount) {
    while (true) {
        if (mTTSSampleIndex > UINT32_MAX - mTTSCount) {
            return ERROR_OUT_OF_RANGE;
        }
        if(sampleIndex < mTTSSampleIndex + mTTSCount) {
            break;
        }
        if (mTimeToSampleIndex == mTable->mTimeToSampleCount ||
            mTTSCount > UINT32_MAX / mTTSDuration ||
            mTTSSampleTime > UINT32_MAX - (mTTSCount * mTTSDuration)) {
            return ERROR_OUT_OF_RANGE;
        }