aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-02 22:05:52 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 11:30:43 +0100
commit2c6beca3dc253fa11d243a3718aa7f1a139a08c2 (patch)
tree130ec613a4ce4a9b99885fe31aab29916c16d8bb /libavcodec
parentd08362ecbc5863fdea4e641baf3e996082db8c9b (diff)
downloadffmpeg-2c6beca3dc253fa11d243a3718aa7f1a139a08c2.tar.gz
avcodec/ptx: Check that the input contains at least one line
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> (cherry picked from commit a6ad328256fe6a6ace7d1e15f3515afccf1247fc) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ptx.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c
index 42147f4afc..19f9305cda 100644
--- a/libavcodec/ptx.c
+++ b/libavcodec/ptx.c
@@ -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;