Bug 1737816 - Handle truncated mp3 resources. r=bryce, a=RyanVM

This commit is contained in:
roytam1 2022-01-19 10:13:45 +08:00
commit 258790bf38

View file

@ -676,8 +676,9 @@ MP3TrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize) {
const int64_t streamLen = StreamLength();
if (mInfo && streamLen > 0) {
uint64_t max = streamLen > aOffset ? streamLen - aOffset : 0;
// Prevent blocking reads after successful initialization.
aSize = std::min<int64_t>(aSize, streamLen - aOffset);
aSize = std::min<int64_t>(aSize, max);
}
uint32_t read = 0;