Bug 1746011 - Handle truncated ADTS stream. r=bryce, a=RyanVM

This commit is contained in:
roytam1 2022-01-19 10:11:44 +08:00
commit 62a879b694

View file

@ -819,8 +819,9 @@ ADTSTrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize)
const int64_t streamLen = StreamLength();
if (mInfo && streamLen > 0) {
int64_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;