aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-10 00:56:45 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-20 03:41:33 +0200
commit1c75d1b54b88d0a0a69d0c48bc1be8404d4bc0ac (patch)
treed78e2180e2707006a7c4edf7a7652e3d7957e723 /libavcodec
parent5380abf7854fef03925df81ed7d172cee5be4572 (diff)
downloadffmpeg-1c75d1b54b88d0a0a69d0c48bc1be8404d4bc0ac.tar.gz
avcodec/lagarith: Check scale_factor
Fixes: 1425/clusterfuzz-testcase-minimized-6295712339853312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit ed3c9b5b0dd5abb545c48e930e1c32c187b0776a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/lagarith.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index a8d5cef83e..ea069b3d04 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -191,7 +191,9 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
}
scale_factor++;
- cumulative_target = 1 << scale_factor;
+ if (scale_factor >= 32U)
+ return AVERROR_INVALIDDATA;
+ cumulative_target = 1U << scale_factor;
if (scaled_cumul_prob > cumulative_target) {
av_log(rac->avctx, AV_LOG_ERROR,