diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2009-03-10 12:55:29 +0000 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2009-03-10 12:55:29 +0000 |
commit | b5b9ff2a1f1c3747f739f296c05f3c14373dd325 (patch) | |
tree | be0aa1583213bcd7b82ad7106775564b6a4d13c6 /libavformat | |
parent | 5e622c401f4f7e4063999dafebee37d7302b6892 (diff) | |
download | ffmpeg-streaming-b5b9ff2a1f1c3747f739f296c05f3c14373dd325.zip ffmpeg-streaming-b5b9ff2a1f1c3747f739f296c05f3c14373dd325.tar.gz |
Correctly skip complete INDX chunks, i.e. read the 32-bit header correctly
and if the size is broken (20 bytes, header-only), calculate the expected
size and skip the index entries anyway. See "[PATCH] rmdec.c: correctly
skip indexes" thread.
Originally committed as revision 17924 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rmdec.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index befec2a..a017418 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -440,7 +440,19 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ state= (state<<8) + get_byte(pb); if(state == MKBETAG('I', 'N', 'D', 'X')){ - len = get_be16(pb) - 6; + int n_pkts, expected_len; + len = get_be32(pb); + url_fskip(pb, 2); + n_pkts = get_be32(pb); + expected_len = 20 + n_pkts * 14; + if (len == 20) + /* some files don't add index entries to chunk size... */ + len = expected_len; + else if (len != expected_len) + av_log(s, AV_LOG_WARNING, + "Index size %d (%d pkts) is wrong, should be %d.\n", + len, n_pkts, expected_len); + len -= 14; // we already read part of the index header if(len<0) continue; goto skip; |