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

Commit 6a84e6dc authored by Chad Brubaker's avatar Chad Brubaker Committed by Android Git Automerger
Browse files

am 20e7a377: am fc608967: am d98db140: Merge "Fix benign unsigned overflow in OggExtractor"

* commit '20e7a377':
  Fix benign unsigned overflow in OggExtractor
parents 3b50fc90 20e7a377
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -770,8 +770,13 @@ status_t MyOggExtractor::_readNextPacket(MediaBuffer **out, bool calcVorbisTimes
            return n < 0 ? n : (status_t)ERROR_END_OF_STREAM;
        }

        // Prevent a harmless unsigned integer overflow by clamping to 0
        if (mCurrentPage.mGranulePosition >= mPrevGranulePosition) {
            mCurrentPageSamples =
                    mCurrentPage.mGranulePosition - mPrevGranulePosition;
        } else {
            mCurrentPageSamples = 0;
        }
        mFirstPacketInPage = true;

        mPrevGranulePosition = mCurrentPage.mGranulePosition;