[FFmpeg-cvslog] avcodec/dirac_vlc: Fix invalid shift in ff_dirac_golomb_read_32bit()

Michael Niedermayer git at videolan.org
Sun Sep 17 13:59:50 EEST 2017


ffmpeg | branch: release/3.2 | Michael Niedermayer <michael at niedermayer.cc> | Fri Sep  1 19:56:12 2017 +0200| [372bb594385f97c31981e5ab5bf4c6cd56959102] | committer: Michael Niedermayer

avcodec/dirac_vlc: Fix invalid shift in ff_dirac_golomb_read_32bit()

Fixes: runtime error: shift exponent 64 is too large for 64-bit type 'residual' (aka 'unsigned long')
Fixes: 2838/clusterfuzz-testcase-minimized-6260066086813696

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 c595139f1fdb5ce5ee128c317ed9e4e836282436)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c
index 773f720858..b642ee8599 100644
--- a/libavcodec/dirac_vlc.c
+++ b/libavcodec/dirac_vlc.c
@@ -56,6 +56,9 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
         if ((c_idx + 1) > coeffs)
             return c_idx;
 
+        if (res_bits >= RSIZE_BITS)
+            res_bits = res = 0;
+
         /* res_bits is a hint for better branch prediction */
         if (res_bits && l->sign) {
             int32_t coeff = 1;



More information about the ffmpeg-cvslog mailing list