diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-13 19:16:39 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-13 19:16:39 +0000 |
commit | 59e83201dd9220941e44a3826216c96fd669ffbf (patch) | |
tree | 4650a4157258f8894ab5576e738152f5cb1db4e7 /libmpdemux/asfheader.c | |
parent | fec63334f85afff451f4fa02ea7e40d0014095d5 (diff) | |
download | mpv-59e83201dd9220941e44a3826216c96fd669ffbf.tar.bz2 mpv-59e83201dd9220941e44a3826216c96fd669ffbf.tar.xz |
Try to handle oversized asf headers by ignoring anything beyond the first MB
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20894 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/asfheader.c')
-rw-r--r-- | libmpdemux/asfheader.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c index 9644e0286d..4fa6ba935b 100644 --- a/libmpdemux/asfheader.c +++ b/libmpdemux/asfheader.c @@ -231,6 +231,7 @@ static int asf_init_audio_stream(demuxer_t *demuxer,struct asf_priv* asf, sh_aud int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ int hdr_len = asf->header.objh.size - sizeof(asf->header); + int hdr_skip = 0; char *hdr = NULL; char guid_buffer[16]; int pos, start = stream_tell(demuxer->stream); @@ -251,9 +252,10 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ } if (hdr_len > 1024 * 1024) { - mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_HeaderSizeOver1MB, + mp_msg(MSGT_HEADER, MSGL_ERR, MSGTR_MPDEMUX_ASFHDR_HeaderSizeOver1MB, hdr_len); - return 0; + hdr_skip = hdr_len - 1024 * 1024; + hdr_len = 1024 * 1024; } hdr = malloc(hdr_len); if (!hdr) { @@ -262,6 +264,8 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ return 0; } stream_read(demuxer->stream, hdr, hdr_len); + if (hdr_skip) + stream_skip(demuxer->stream, hdr_skip); if (stream_eof(demuxer->stream)) { mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_EOFWhileReadingHeader); goto err_out; |