diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-08-12 22:43:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-10-07 21:34:00 +0200 |
commit | 2c3ea340826a687ed82ff236f7ac798a622650f5 (patch) | |
tree | f07c9f555c2390884c967cc0a9e0b4fef5076c82 | |
parent | c0a6febf32318326af0d2a85b104ea6674c55d50 (diff) | |
download | ffmpeg-2c3ea340826a687ed82ff236f7ac798a622650f5.tar.gz |
avcodec/shorten: Check verbatim length
Fixes: Timeout
Fixes: 9252/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5780720709533696
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 7007dabec08f2f9f81661e71ef482dde394e17a8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/shorten.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 0f491090fd..9094d3fc55 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -623,6 +623,11 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data, switch (cmd) { case FN_VERBATIM: len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE); + if (len < 0 || len > get_bits_left(&s->gb)) { + av_log(avctx, AV_LOG_ERROR, "verbatim length %d invalid\n", + len); + return AVERROR_INVALIDDATA; + } while (len--) get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE); break; |