avcodec/ralf: fix undefined shift in extend_code()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 17 Aug 2019 17:25:01 +0000 (19:25 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 2 Sep 2019 19:37:18 +0000 (21:37 +0200)
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

index d2d803b..75c9371 100644 (file)
@@ -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;
 }