+1
−1
dom/media/test/crashtests/2014865.html
0 → 100644
+91
−0
Loading
Bug 2014865 - Fix int64_t overflow in TimeUnit::FromSeconds boundary condition. r=media-playback-reviewers,alwu
TimeUnit::FromSeconds() had undefined behavior when converting values at the
boundary of int64_t representability. Specifically, when the input value times
the base equals exactly 2^63:
static_cast<double>(INT64_MAX) rounds UP to 2^63 (INT64_MAX = 2^63-1 cannot be exactly represented as double)
The check used strict >, so inBase == 2^63 passed the overflow check
static_cast<int64_t>(std::round(2^63)) is undefined behavior since 2^63 exceeds INT64_MAX, producing INT64_MIN on x86-64
This created invalid TimeUnits, causing assertion failures in TimeInterval construction (mStart <= mEnd)
The fix changes > to >= to properly catch this boundary case.
Differential Revision: https://phabricator.services.mozilla.com/D282394