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

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

Merge "Fix potential overflows" am: a0c1eb86 am: ef354234 am: 2774f292

am: 3bcc22b1

Change-Id: I78bd28ee6abb4befea5c46c8d4be8799b88b227b
parents b16ebe14 3bcc22b1
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;
        }