From 231b3317184790b6be4b4619d96fd328f13aeabb Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Mon, 13 May 2013 12:39:44 +0200
Subject: [PATCH] Do not read strd chunk in avi files as H264 extradata.

Fixes ticket #2561.
---
 libavformat/avidec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 2066c18f651..b80effc33cd 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);
-- 
GitLab