]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/cscd: Check output len in zlib as in lzo
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 11 Nov 2020 22:17:50 +0000 (23:17 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 31 Jan 2021 13:37:07 +0000 (14:37 +0100)
Fixes: Timeout (>10sec -> 134ms)
Fixes: 27245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CSCD_fuzzer-575318210772992
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/cscd.c

index d50ddd6258ce515da401f7627651bb331da49392..f5c93e99125a4eca67726b7e5da7521686f5dfbd 100644 (file)
@@ -93,7 +93,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     case 1: { // zlib compression
 #if CONFIG_ZLIB
         unsigned long dlen = c->decomp_size;
-        if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK) {
+        if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK || dlen != c->decomp_size) {
             av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
             return AVERROR_INVALIDDATA;
         }