avcodec/mpeg12dec: Fix runtime error: left shift of negative value -1
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 12 Mar 2017 02:04:04 +0000 (03:04 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 13 Mar 2017 03:48:43 +0000 (04:48 +0100)
Fixes: 764/clusterfuzz-testcase-6273034652483584

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mpeg12dec.c

index 27db14c..e49167f 100644 (file)
@@ -994,7 +994,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
 
             cbp = get_vlc2(&s->gb, ff_mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
             if (mb_block_count > 6) {
-                cbp <<= mb_block_count - 6;
+                cbp *= 1 << mb_block_count - 6;
                 cbp  |= get_bits(&s->gb, mb_block_count - 6);
                 s->bdsp.clear_blocks(s->block[6]);
             }