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

Commit d98db140 authored by Chad Brubaker's avatar Chad Brubaker Committed by Gerrit Code Review
Browse files

Merge "Fix benign unsigned overflow in OggExtractor"

parents b55897a7 2369bda5
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -567,8 +567,13 @@ status_t MyVorbisExtractor::readNextPacket(MediaBuffer **out, bool conf) {
            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;