diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-29 01:23:41 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-05-09 22:04:14 +0200 |
commit | 8d77debf7dab556b93ea9e936a7762b8e31420ac (patch) | |
tree | 77325b06f074c66cd78b9ace9a9289f437123294 /libavcodec/pafvideo.c | |
parent | 6dd8420290ef79945ec33e65fc3751e6e0bd9433 (diff) | |
download | ffmpeg-8d77debf7dab556b93ea9e936a7762b8e31420ac.tar.gz |
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/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/pafvideo.c')
-rw-r--r-- | libavcodec/pafvideo.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/pafvideo.c b/libavcodec/pafvideo.c index 7c5861dfaf..7bfd6815df 100644 --- a/libavcodec/pafvideo.c +++ b/libavcodec/pafvideo.c @@ -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; |