mirror of https://github.com/mpv-player/mpv
demux_mkv: don't seek outside of the file when finding segments
The end of the current segment will be the end of the file if there is no next segment. Normally, this didn't matter much, since UNIX files allow seeking past the end of the file. But when opening files from HTTP, this would print confusing error messages. So explicitly check for EOF before trying to read a segment.
This commit is contained in:
parent
2f49fbff93
commit
50b3cfa221
|
@ -1788,7 +1788,10 @@ static int read_mkv_segment_header(demuxer_t *demuxer)
|
|||
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] (skipping)\n");
|
||||
if (len == EBML_UINT_INVALID)
|
||||
break;
|
||||
if (!stream_seek(s, stream_tell(s) + len)) {
|
||||
int64_t next = stream_tell(s) + len;
|
||||
if (next >= s->end_pos)
|
||||
return 0;
|
||||
if (!stream_seek(s, next)) {
|
||||
mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Failed to seek in file\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue