aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-04-07 19:29:44 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-02 19:55:09 +0200
commit997d5b45b58ddb8acdc0cec3e216b238eeb08105 (patch)
tree3e5235c69b60c3610bd5702dcc6b7bdb59a89ca4
parent77751f605383b9af212bce74c62a6d81c4837b61 (diff)
downloadffmpeg-997d5b45b58ddb8acdc0cec3e216b238eeb08105.tar.gz
avcodec/pngdec: Check length in fdAT
Fixes: 21089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5135981419429888 Fixes: out of array read 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 79e5c2ee2bbdf462cabd2113c723dfb613d735c2) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/pngdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index c0bb60ecc1..9d2c74d758 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1239,7 +1239,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
case MKTAG('f', 'd', 'A', 'T'):
if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)
goto skip_tag;
- if (!decode_next_dat) {
+ if (!decode_next_dat || length < 4) {
ret = AVERROR_INVALIDDATA;
goto fail;
}