[FFmpeg-devel] [PATCH 2/2] ffmdec: reject zero-sized chunks

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Wed Dec 2 23:13:44 CET 2015


If size is zero, avio_get_str fails, leaving the buffer uninitialized.
This causes invalid reads in av_set_options_string.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavformat/ffmdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 9ad771e..afba905 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -423,7 +423,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;
             }
@@ -438,7 +438,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;
             }
-- 
2.6.2


More information about the ffmpeg-devel mailing list