aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-11-09 03:12:45 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-11-18 02:35:03 +0100
commitde1d2ea6b20ac6c2a2bf23e67d07a86b87836386 (patch)
treec79cc219214ef0c4806b9bdbf6c37f05841866ae
parent0612e6a0d7dea838211e60c53491a0caff1842d4 (diff)
downloadffmpeg-de1d2ea6b20ac6c2a2bf23e67d07a86b87836386.tar.gz
avcodec/pngdec: Check compression method
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> (cherry picked from commit 1f99674ddddcc33f4c37def0a206e31ad7c4c1af) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/pngdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 7f0d416683..10d0575f70 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -566,6 +566,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 */