aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-04-27 23:49:33 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-05-25 02:04:43 +0200
commit4fd74a2b104f3e67f251b67099f5855c386a55bd (patch)
tree7c6042b2e59cc2741c190ed650d1a81461c15a49 /libavcodec
parent1eb54323c82ff6eff18553fd3f2788a695bdf812 (diff)
downloadffmpeg-4fd74a2b104f3e67f251b67099f5855c386a55bd.tar.gz
avcodec/pngdec: Check nb_blocks
Fixes: Timeout (23sec -> 0.5sec) Fixes: 14329/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LSCR_fuzzer-5679252923482112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pngdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 6a681be29d..7fcf83e347 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1541,6 +1541,8 @@ static int decode_frame_lscr(AVCodecContext *avctx,
return ret;
nb_blocks = bytestream2_get_le16(gb);
+ if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * 12)
+ return AVERROR_INVALIDDATA;
if (s->last_picture.f->data[0]) {
ret = av_frame_copy(frame, s->last_picture.f);