[FFmpeg-cvslog] avcodec/ralf: fix undefined shift in extend_code()

Michael Niedermayer git at videolan.org
Mon Sep 2 22:38:09 EEST 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Aug 17 19:25:01 2019 +0200| [4778407ab3b545c40def7e95a8f9dd4ae92a4e8e] | committer: Michael Niedermayer

avcodec/ralf: fix undefined shift in extend_code()

Fixes: left shift of negative value -3
Fixes: 16147/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5658392722407424

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

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

 libavcodec/ralf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index d2d803b0d4..75c9371b95 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -220,7 +220,7 @@ static inline int extend_code(GetBitContext *gb, int val, int range, int bits)
         val -= range;
     }
     if (bits)
-        val = (val << bits) | get_bits(gb, bits);
+        val = ((unsigned)val << bits) | get_bits(gb, bits);
     return val;
 }
 



More information about the ffmpeg-cvslog mailing list