aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-07-10 23:02:36 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-14 23:30:37 +0100
commit0af60924ea506457dc82e95b012d4c57824d07fe (patch)
treea8d02f0c7d2f7b4f052b9f58003d58b27c47bbe5 /libavcodec
parent2b0180f80b1eb791850a8667128f84fdf011c0d1 (diff)
downloadffmpeg-0af60924ea506457dc82e95b012d4c57824d07fe.tar.gz
avcodec/pngdec: Check that previous_picture has same w/h/format
Fixes: out of array access Fixes: 15540/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5684905029140480 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> (cherry picked from commit 18c808ffbed81ea580fe6ddd6524dd7bea3f8d0e) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pngdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 0a2772f763..1faf80108b 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1352,6 +1352,9 @@ exit_loop:
if (CONFIG_PNG_DECODER && avctx->codec_id != AV_CODEC_ID_APNG)
handle_p_frame_png(s, p);
else if (CONFIG_APNG_DECODER &&
+ s->previous_picture.f->width == p->width &&
+ s->previous_picture.f->height== p->height &&
+ s->previous_picture.f->format== p->format &&
avctx->codec_id == AV_CODEC_ID_APNG &&
(ret = handle_p_frame_apng(avctx, s, p)) < 0)
goto fail;