[FFmpeg-cvslog] avcodec/lagarith: Check scale_factor

Michael Niedermayer git at videolan.org
Wed May 10 02:11:31 EEST 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed May 10 00:56:45 2017 +0200| [ed3c9b5b0dd5abb545c48e930e1c32c187b0776a] | committer: Michael Niedermayer

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed3c9b5b0dd5abb545c48e930e1c32c187b0776a
---

 libavcodec/lagarith.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index 044497720f..1f4afc5312 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,



More information about the ffmpeg-cvslog mailing list