[FFmpeg-cvslog] avformat/avidec: Fix demuxing avi with broken index

Michael Niedermayer git at videolan.org
Mon Jul 20 02:22:48 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Jul 20 02:10:40 2015 +0200| [bf1fd59c6a22854ddc601f3125ff55ba5f82ad24] | committer: Michael Niedermayer

avformat/avidec: Fix demuxing avi with broken index

Fixes: genio-avi

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf1fd59c6a22854ddc601f3125ff55ba5f82ad24
---

 libavformat/avidec.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 73d1d16..2f63722 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;
         }
 



More information about the ffmpeg-cvslog mailing list