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

Commit 1f4ba5f9 authored by Santiago Seifert's avatar Santiago Seifert Committed by Android (Google) Code Review
Browse files

Merge "Abort operation upon arithmetic overflows" into sc-dev

parents be2afc55 0f2041fd
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -504,7 +504,14 @@ media_status_t MP3Source::read(
            }

            mCurrentTimeUs = seekTimeUs;
            mCurrentPos = mFirstFramePos + seekTimeUs * bitrate / 8000000;
            int64_t seekTimeUsTimesBitrate;
            if (__builtin_mul_overflow(seekTimeUs, bitrate, &seekTimeUsTimesBitrate)) {
              return AMEDIA_ERROR_UNSUPPORTED;
            }
            if (__builtin_add_overflow(
                    mFirstFramePos, seekTimeUsTimesBitrate / 8000000, &mCurrentPos)) {
                return AMEDIA_ERROR_UNSUPPORTED;
            }
            seekCBR = true;
        } else {
            mCurrentTimeUs = actualSeekTimeUs;