Commit e706e2e7 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/ffmdec: Check media type for chunks

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 591c0324
...@@ -381,7 +381,7 @@ static int ffm2_read_header(AVFormatContext *s) ...@@ -381,7 +381,7 @@ static int ffm2_read_header(AVFormatContext *s)
} }
break; break;
case MKBETAG('S', 'T', 'V', 'I'): case MKBETAG('S', 'T', 'V', 'I'):
if (f_stvi++) { if (f_stvi++ || codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
ret = AVERROR(EINVAL); ret = AVERROR(EINVAL);
goto fail; goto fail;
} }
...@@ -445,7 +445,7 @@ static int ffm2_read_header(AVFormatContext *s) ...@@ -445,7 +445,7 @@ static int ffm2_read_header(AVFormatContext *s)
avio_rb32(pb); // refs avio_rb32(pb); // refs
break; break;
case MKBETAG('S', 'T', 'A', 'U'): case MKBETAG('S', 'T', 'A', 'U'):
if (f_stau++) { if (f_stau++ || codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
ret = AVERROR(EINVAL); ret = AVERROR(EINVAL);
goto fail; goto fail;
} }
...@@ -474,7 +474,7 @@ static int ffm2_read_header(AVFormatContext *s) ...@@ -474,7 +474,7 @@ static int ffm2_read_header(AVFormatContext *s)
} }
break; break;
case MKBETAG('S', '2', 'V', 'I'): case MKBETAG('S', '2', 'V', 'I'):
if (f_stvi++ || !size) { if (f_stvi++ || !size || codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
ret = AVERROR(EINVAL); ret = AVERROR(EINVAL);
goto fail; goto fail;
} }
...@@ -492,7 +492,7 @@ static int ffm2_read_header(AVFormatContext *s) ...@@ -492,7 +492,7 @@ static int ffm2_read_header(AVFormatContext *s)
goto fail; goto fail;
break; break;
case MKBETAG('S', '2', 'A', 'U'): case MKBETAG('S', '2', 'A', 'U'):
if (f_stau++ || !size) { if (f_stau++ || !size || codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
ret = AVERROR(EINVAL); ret = AVERROR(EINVAL);
goto fail; goto fail;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment