diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-09-25 18:35:09 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-09-25 18:35:09 +0300 |
commit | c9e681fca3a516899018cfde0b7ea964476b2107 (patch) | |
tree | c0500ce141ab2f05dd890665b3d952820c6b9356 | |
parent | eb66a3fe0795321e4008d5989cfc911a550ee666 (diff) | |
download | mpv-c9e681fca3a516899018cfde0b7ea964476b2107.tar.bz2 mpv-c9e681fca3a516899018cfde0b7ea964476b2107.tar.xz |
demux_mkv: avoid hang with some broken files
Return failure to open file in one case that could lead to an infinite
loop with broken Matroska files before.
-rw-r--r-- | libmpdemux/demux_mkv.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c index 85b18319d7..00990f50d4 100644 --- a/libmpdemux/demux_mkv.c +++ b/libmpdemux/demux_mkv.c @@ -1676,6 +1676,10 @@ static int demux_mkv_open(demuxer_t *demuxer) while (1) { uint32_t id = ebml_read_id(s, NULL); + if (s->eof) { + mp_tmsg(MSGT_DEMUX, MSGL_ERR, "[mkv] Unexpected end of file\n"); + return 0; + } if (id == MATROSKA_ID_CLUSTER) { mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] |+ found cluster, headers are " "parsed completely :)\n"); |