]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/qdrw: Check input for header/skiped space before get_buffer()
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 7 Oct 2019 14:14:32 +0000 (16:14 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 24 Oct 2019 22:22:33 +0000 (00:22 +0200)
Fixes: Timeout (21sec -> 0.8sec)
Fixes: 17990/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDRAW_fuzzer-5200374436200448
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/qdrw.c

index 32ba41096863a5a35381f98201728d818da15b98..65279c98052b81a129c6fa901c5c025525b68d9c 100644 (file)
@@ -455,6 +455,8 @@ static int decode_frame(AVCodecContext *avctx,
                 avpriv_request_sample(avctx, "Pack type %d", pack_type);
                 return AVERROR_PATCHWELCOME;
             }
+            if (bytestream2_get_bytes_left(&gbc) < 30)
+                return AVERROR_INVALIDDATA;
             if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
                 return ret;