]> git.sesse.net Git - ffmpeg/commitdiff
avformat/ffmdec: Check media type for chunks
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 3 Dec 2016 12:39:56 +0000 (13:39 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 3 Dec 2016 13:05:15 +0000 (14:05 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/ffmdec.c

index a8c601b8b3c8b0ac0aaa1730ca827ae408ea5e1c..c76c3e527626ea2724192ade64de4274d86e19c0 100644 (file)
@@ -381,7 +381,7 @@ static int ffm2_read_header(AVFormatContext *s)
             }
             break;
         case MKBETAG('S', 'T', 'V', 'I'):
-            if (f_stvi++) {
+            if (f_stvi++ || codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
                 ret = AVERROR(EINVAL);
                 goto fail;
             }
@@ -445,7 +445,7 @@ static int ffm2_read_header(AVFormatContext *s)
             avio_rb32(pb); // refs
             break;
         case MKBETAG('S', 'T', 'A', 'U'):
-            if (f_stau++) {
+            if (f_stau++ || codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
                 ret = AVERROR(EINVAL);
                 goto fail;
             }
@@ -474,7 +474,7 @@ static int ffm2_read_header(AVFormatContext *s)
             }
             break;
         case MKBETAG('S', '2', 'V', 'I'):
-            if (f_stvi++ || !size) {
+            if (f_stvi++ || !size || codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
                 ret = AVERROR(EINVAL);
                 goto fail;
             }
@@ -492,7 +492,7 @@ static int ffm2_read_header(AVFormatContext *s)
                 goto fail;
             break;
         case MKBETAG('S', '2', 'A', 'U'):
-            if (f_stau++ || !size) {
+            if (f_stau++ || !size || codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
                 ret = AVERROR(EINVAL);
                 goto fail;
             }