aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-08-12 22:43:33 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-11-01 00:52:46 +0100
commit488c246bf565d56f153874d1348435c7187679a1 (patch)
treeb2ff08b29f5bb41d3b343dc45589f318413cc886 /libavcodec
parent0ea1b62b9ac50739b12b9d72c991456ed2f2d192 (diff)
downloadffmpeg-488c246bf565d56f153874d1348435c7187679a1.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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/shorten.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 68c2a2d804..010000d0a1 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;