Commit fee66610 authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent caa9b4ff
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment