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

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

am f7ec627f: am 1127e1b6: Merge "Fix benign overflow in getTimeUsOfGranule"

* commit 'f7ec627f':
  Fix benign overflow in getTimeUsOfGranule
parents 885b6775 f7ec627f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -179,6 +179,9 @@ struct MyVorbisExtractor : public MyOggExtractor {

protected:
    virtual int64_t getTimeUsOfGranule(uint64_t granulePos) const {
        if (granulePos > INT64_MAX / 1000000ll) {
            return INT64_MAX;
        }
        return granulePos * 1000000ll / mVi.rate;
    }

@@ -922,6 +925,9 @@ int64_t MyOpusExtractor::getTimeUsOfGranule(uint64_t granulePos) const {
    if (granulePos > mCodecDelay) {
        pcmSamplePosition = granulePos - mCodecDelay;
    }
    if (pcmSamplePosition > INT64_MAX / 1000000ll) {
        return INT64_MAX;
    }
    return pcmSamplePosition * 1000000ll / kOpusSampleRate;
}