summaryrefslogtreecommitdiff
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-07-20 02:10:40 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-20 02:11:49 +0200
commitbf1fd59c6a22854ddc601f3125ff55ba5f82ad24 (patch)
tree5ade412e289a25b95725e511746177311df418f4 /libavformat/avidec.c
parent749f85496ccff345ec811976ce45ec9e1900e9a8 (diff)
avformat/avidec: Fix demuxing avi with broken index
Fixes: genio-avi Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 73d1d166ea..2f637225e9 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1681,9 +1681,13 @@ static int guess_ni_flag(AVFormatContext *s)
if (n >= 2) {
int64_t pos = st->index_entries[0].pos;
- avio_seek(s->pb, pos + 4, SEEK_SET);
+ unsigned tag[2];
+ avio_seek(s->pb, pos, SEEK_SET);
+ tag[0] = avio_r8(s->pb);
+ tag[1] = avio_r8(s->pb);
+ avio_rl16(s->pb);
size = avio_rl32(s->pb);
- if (pos + size > st->index_entries[1].pos)
+ if (get_stream_idx(tag) == i && pos + size > st->index_entries[1].pos)
last_start = INT64_MAX;
}