Bug 1492365 - Prevent arithmetic overflow. r=gerald

Should mStreamLength be > 2^32, we could have overflowed leading to false positive test.

Differential Revision: https://phabricator.services.mozilla.com/D6235

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2018-09-19 08:34:15 +00:00
parent 70bf79757d
commit 5957f22482

View File

@ -2632,7 +2632,7 @@ MediaCacheStream::ReadBlockFromCache(AutoLock& aLock,
}
if (mStreamLength >= 0 &&
aBuffer.Length() > uint32_t(mStreamLength - aOffset)) {
int64_t(aBuffer.Length()) > mStreamLength - aOffset) {
// Clamp reads to stream's length
aBuffer = aBuffer.First(mStreamLength - aOffset);
}