Commit a611375d authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

ffmdec: reject zero-sized chunks

If size is zero, avio_get_str fails, leaving the buffer uninitialized.
This causes invalid reads in av_set_options_string.
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent 488e9a06
...@@ -423,7 +423,7 @@ static int ffm2_read_header(AVFormatContext *s) ...@@ -423,7 +423,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++) { if (f_stvi++ || !size) {
ret = AVERROR(EINVAL); ret = AVERROR(EINVAL);
goto fail; goto fail;
} }
...@@ -438,7 +438,7 @@ static int ffm2_read_header(AVFormatContext *s) ...@@ -438,7 +438,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++) { if (f_stau++ || !size) {
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