aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cscd.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-11-11 23:17:50 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-10 16:04:26 +0200
commitef89d0144989ca738cfb292c3fe3bc4928710b37 (patch)
treedbfd1e2ee4ed8623a06b6eae312d9f448db39d73 /libavcodec/cscd.c
parente4bfc5e4218cb38768e366df5a281c533f6863c2 (diff)
downloadffmpeg-ef89d0144989ca738cfb292c3fe3bc4928710b37.tar.gz
avcodec/cscd: Check output len in zlib as in lzo
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> (cherry picked from commit 6de039823c2ffcf88e8bfff0d4e3ed9d5601a122) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/cscd.c')
-rw-r--r--libavcodec/cscd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
index 8781df110c..e2d868353f 100644
--- a/libavcodec/cscd.c
+++ b/libavcodec/cscd.c
@@ -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;
}