diff options
author | Paul Adenot <paul@paul.cx> | 2022-02-11 13:58:13 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-03 01:13:41 +0200 |
commit | 01782d03bc1c04a39a27094faa6ee1f7f0a3680a (patch) | |
tree | a1d75f4d419109feb9635c87d6d92d149eb536e2 | |
parent | 2bb9285528b55e1baaf8da536a27bc95b1f4c3b0 (diff) | |
download | uxp-01782d03bc1c04a39a27094faa6ee1f7f0a3680a.tar.gz |
[DOM media] Handle truncated WAV stream.
-rw-r--r-- | dom/media/wave/WaveDemuxer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/dom/media/wave/WaveDemuxer.cpp b/dom/media/wave/WaveDemuxer.cpp index 387a756759..5243909dec 100644 --- a/dom/media/wave/WaveDemuxer.cpp +++ b/dom/media/wave/WaveDemuxer.cpp @@ -611,7 +611,8 @@ WAVTrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize) { const int64_t streamLen = StreamLength(); if (mInfo && streamLen > 0) { - aSize = std::min<int64_t>(aSize, streamLen - aOffset); + int64_t max = streamLen > aOffset ? streamLen - aOffset : 0; + aSize = std::min<int64_t>(aSize, max); } uint32_t read = 0; const nsresult rv = mSource.ReadAt(aOffset, |