[FFmpeg-devel,2/6] avcodec/ralf: fix undefined shift in extend_code()

Submitted by Michael Niedermayer on Aug. 17, 2019, 11:28 p.m.

Details

Message ID 20190817232841.14709-2-michael@niedermayer.cc
State Accepted
Commit 4778407ab3b545c40def7e95a8f9dd4ae92a4e8e
Headers show

Commit Message

Michael Niedermayer Aug. 17, 2019, 11:28 p.m.
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@niedermayer.cc>
---
 libavcodec/ralf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 2, 2019, 6:17 p.m.
On Sun, Aug 18, 2019 at 01:28:37AM +0200, Michael Niedermayer wrote:
> 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@niedermayer.cc>
> ---
>  libavcodec/ralf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]

Patch hide | download patch | download mbox

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;
 }