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

Commit bf62345a authored by Venkatarama Avadhani's avatar Venkatarama Avadhani
Browse files

Add INT64_MIN check in MPEG4Writer sample validate

Sample validation uses abs(timeUs) to check for valid range. If timeUs
is equal to INT64_MIN, the abs() function will cause an overflow.

Test: ndk_mediamuxer_fuzzer
Bug: 323256800
Change-Id: I501c6ac52e52809880f51b67749a88d5cfc86d0c
parent 8a1ab3f4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2454,6 +2454,11 @@ bool MPEG4Writer::Track::isTimestampValid(int64_t timeUs) {
        return true;
    }

    // Make sure abs(timeUs) does not overflow
    if (timeUs == INT64_MIN) {
       return false;
    }

    // Ensure that the timeUs value does not have extremely low or high values
    // that would cause an underflow or overflow, like in the calculation -
    // mdhdDuration = (trakDurationUs * mTimeScale + 5E5) / 1E6