[FFmpeg-cvslog] avcodec/lagarith: Sanity check scale

Michael Niedermayer git at videolan.org
Fri Apr 24 02:13:43 EEST 2020


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Tue Jan 28 20:12:25 2020 +0100| [67f6cab06fec24ad215456dc5533c7d5b4ae19ea] | committer: Michael Niedermayer

avcodec/lagarith: Sanity check scale

A value of 24 and above can collaps the range to 0 which would not work.

Fixes: Timeout (75sec -> 21sec)
Fixes: 18707/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5708950892969984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit fb3855342b9e4c577c63b38a7a5a574830a21934)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index ea069b3d04..b0914dc1bc 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -222,6 +222,9 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
         }
     }
 
+    if (scale_factor > 23)
+        return AVERROR_INVALIDDATA;
+
     rac->scale = scale_factor;
 
     /* Fill probability array with cumulative probability for each symbol. */



More information about the ffmpeg-cvslog mailing list