aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-04-15 02:01:56 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-04-24 17:05:02 +0200
commitfee666104519ec7889ec3242404857bed7598a36 (patch)
tree4c78df8cbbef7db5a9c81be5d748f5b8d8be23f3
parentcaa9b4ff89c00591a0730d2cc5db8693da8dffba (diff)
downloadffmpeg-fee666104519ec7889ec3242404857bed7598a36.tar.gz
avcodec/dsicinvideo: check the amount decoded by cin_decode_huffman()
Fixes: Timeout (158sec -> 36sec) Fixes: 14214/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSICINVIDEO_fuzzer-5633569034076160 This is untested with valid cin files as none of the files i found cover the changed codepath Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dsicinvideo.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/dsicinvideo.c b/libavcodec/dsicinvideo.c
index 37175d67b2..d422df068d 100644
--- a/libavcodec/dsicinvideo.c
+++ b/libavcodec/dsicinvideo.c
@@ -266,8 +266,11 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 37:
- cin_decode_huffman(buf, bitmap_frame_size,
+ res = cin_decode_huffman(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
+
+ if (cin->bitmap_size - avctx->discard_damaged_percentage*cin->bitmap_size/100 > res)
+ return AVERROR_INVALIDDATA;
break;
case 38:
res = cin_decode_lzss(buf, bitmap_frame_size,