]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/ptx: Check that the input contains at least one line
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 2 Oct 2019 20:05:52 +0000 (22:05 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 20 Oct 2019 17:57:51 +0000 (19:57 +0200)
Fixes: Timeout (19sec -> 44ms)
Fixes: 17816/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PTX_fuzzer-5704459950227456
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ptx.c

index 42147f4afce6d55742d26955cd4d6b9394ccaa03..19f9305cda09fe60f01a4e4b1e5b175654f0ebfb 100644 (file)
@@ -55,6 +55,9 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
     buf += offset;
 
+    if (buf_end - buf < w * bytes_per_pixel)
+        return AVERROR_INVALIDDATA;
+
     if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
         return ret;