summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 387a75675..5243909de 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,