[FFmpeg-devel] [PATCH]Do not always read strd chunk in avi files as extradata

Carl Eugen Hoyos cehoyos at ag.or.at
Sat May 11 18:51:33 CEST 2013


Hi!

Attached patches both fix ticket #2561 here, please comment.

Carl Eugen
-------------- next part --------------
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 2066c18..b80effc 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -713,7 +713,9 @@ static int avi_read_header(AVFormatContext *s)
             }
             break;
         case MKTAG('s', 't', 'r', 'd'):
-            if (stream_index >= (unsigned)s->nb_streams || s->streams[stream_index]->codec->extradata_size) {
+            if (stream_index >= (unsigned)s->nb_streams
+                || s->streams[stream_index]->codec->extradata_size
+                || s->streams[stream_index]->codec->codec_tag == MKTAG('H','2','6','4')) {
                 avio_skip(pb, size);
             } else {
                 uint64_t cur_pos = avio_tell(pb);
-------------- next part --------------
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 2066c18..fec677c 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -713,7 +713,9 @@ static int avi_read_header(AVFormatContext *s)
             }
             break;
         case MKTAG('s', 't', 'r', 'd'):
-            if (stream_index >= (unsigned)s->nb_streams || s->streams[stream_index]->codec->extradata_size) {
+            if (stream_index >= (unsigned)s->nb_streams
+                || s->streams[stream_index]->codec->extradata_size
+                || s->streams[stream_index]->codec->codec_tag != MKTAG('X','M','P','G')) {
                 avio_skip(pb, size);
             } else {
                 uint64_t cur_pos = avio_tell(pb);


More information about the ffmpeg-devel mailing list