Skip to content

Commit

Permalink
Prevent RangeError exception when parsing incomplete PES
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Walch committed Dec 6, 2019
1 parent ffe1569 commit 832fc64
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/demux/tsdemuxer.js
Expand Up @@ -499,6 +499,9 @@ class TSDemuxer {
// 9 bytes : 6 bytes for PES header + 3 bytes for PES extension
payloadStartOffset = pesHdrLen + 9;

if (stream.size <= payloadStartOffset) {
return null;
}
stream.size -= payloadStartOffset;
// reassemble PES packet
pesData = new Uint8Array(stream.size);
Expand Down

0 comments on commit 832fc64

Please sign in to comment.