diff options
author | wm4 <wm4@nowhere> | 2017-12-23 19:02:33 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2017-12-23 14:07:21 -0700 |
commit | 30686dcec3c6b83fd15a741ae972bf491731abc0 (patch) | |
tree | 17a6f7764d66426073f42822f13301821526055e /demux | |
parent | 2c3a172ef12d142c994e8b5e7ff04875b7076841 (diff) | |
download | mpv-30686dcec3c6b83fd15a741ae972bf491731abc0.tar.bz2 mpv-30686dcec3c6b83fd15a741ae972bf491731abc0.tar.xz |
demux_mkv: fix off by one error
Caused by the relatively recent change to packet parsing. This time it
was probably triggered by lace type 0, which reduces the byte length of
a 0 sized packet to 3 (timestamp + flag) instead of 4 (lace count for
other lace types). The thing about laces is just my guess why it worked
for other 0 sized packets, though.
Also remove the redundant and now incorrect check below.
Fixes #5271.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_mkv.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index 90c027188f..f51349621e 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -2506,14 +2506,12 @@ static int read_block(demuxer_t *demuxer, int64_t end, struct block_info *block) goto exit; /* time (relative to cluster time) */ - if (stream_tell(s) + 3 >= endpos) + if (stream_tell(s) + 3 > endpos) goto exit; uint8_t c1 = stream_read_char(s); uint8_t c2 = stream_read_char(s); time = c1 << 8 | c2; - if (stream_tell(s) + 2 > endpos) - goto exit; uint8_t header_flags = stream_read_char(s); block->filepos = stream_tell(s); |