Commit 8d77debf authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/pafvideo: Check input space for decode_0() before slow operations

Fixes: Timeout (11sec -> 2sec)
Fixes: 14403/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5697465698746368

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 6dd84202
......@@ -285,6 +285,10 @@ static int paf_video_decode(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
if ((code & 0xF) == 0 &&
c->video_size / 32 - (int64_t)bytestream2_get_bytes_left(&c->gb) > c->video_size / 32 * (int64_t)avctx->discard_damaged_percentage / 100)
return AVERROR_INVALIDDATA;
if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
return ret;
......
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