]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/pngdec: Check length in fdAT
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 7 Apr 2020 17:29:44 +0000 (19:29 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 9 May 2020 23:09:13 +0000 (01:09 +0200)
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>
libavcodec/pngdec.c

index d72f9bbb80a62f74b650d63b397f28e87a194a32..86f885bbee131126f77cace1354806cbfde735f7 100644 (file)
@@ -1252,7 +1252,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;
             }