summaryrefslogtreecommitdiff
path: root/dom/media
diff options
context:
space:
mode:
authorPaul Adenot <paul@paul.cx>2022-02-11 13:58:13 +0000
committerMoonchild <moonchild@palemoon.org>2022-05-30 08:26:43 +0000
commitbaa0c0a91e5a78df6bc6ec6d1dc845e0252e03c9 (patch)
tree9269bb1f4a9576dc098e1d82d0c1dd41822b235b /dom/media
parent7322bc0e9df42bd43d84ec9be22b00c47a09f3d7 (diff)
downloaduxp-baa0c0a91e5a78df6bc6ec6d1dc845e0252e03c9.tar.gz
[DOM media] Handle truncated WAV stream.
Diffstat (limited to 'dom/media')
-rw-r--r--dom/media/wave/WaveDemuxer.cpp3
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,