]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/pngdec: Check compression method
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 9 Nov 2018 02:12:45 +0000 (03:12 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 16 Nov 2018 09:13:42 +0000 (10:13 +0100)
method 0 (inflate/deflate) is the only specified in the specification and the only supported

Fixes: Timeout
Fixes: 10976/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PNG_fuzzer-5729372588736512
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 01144680f200bcb8343cd0731ceef8fa8a555134..189bb9a4c1733d25a7baae6c43c254dbfac52b89 100644 (file)
@@ -578,6 +578,10 @@ static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s,
     }
     s->color_type       = bytestream2_get_byte(&s->gb);
     s->compression_type = bytestream2_get_byte(&s->gb);
+    if (s->compression_type) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid compression method %d\n", s->compression_type);
+        goto error;
+    }
     s->filter_type      = bytestream2_get_byte(&s->gb);
     s->interlace_type   = bytestream2_get_byte(&s->gb);
     bytestream2_skip(&s->gb, 4); /* crc */