avformat/avidec: Fix demuxing avi with broken index

Fixes: genio-avi

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2015-07-20 02:10:40 +02:00
parent 749f85496c
commit bf1fd59c6a
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}