diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-12-02 22:47:12 +0100 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-12-17 20:02:55 +0100 |
commit | 76af12f5429b72820afd3b448cb38e9709993b03 (patch) | |
tree | 912312f8c3661699c6871e0519a209d26ece4e9b | |
parent | 20a48eaaf18b073eee9a3128642929e211c4e054 (diff) | |
download | ffmpeg-76af12f5429b72820afd3b448cb38e9709993b03.tar.gz |
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: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit a611375db532c3d5363d97b10fadd0211811a4fd)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r-- | libavformat/ffmdec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index b743c872c0..7fa66ba631 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -415,7 +415,7 @@ static int ffm2_read_header(AVFormatContext *s) } break; case MKBETAG('S', '2', 'V', 'I'): - if (f_stvi++) { + if (f_stvi++ || !size) { ret = AVERROR(EINVAL); goto fail; } @@ -430,7 +430,7 @@ static int ffm2_read_header(AVFormatContext *s) goto fail; break; case MKBETAG('S', '2', 'A', 'U'): - if (f_stau++) { + if (f_stau++ || !size) { ret = AVERROR(EINVAL); goto fail; } |