]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/shorten: Fix a negative left shift in shorten_decode_frame()
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 5 Jun 2018 11:12:54 +0000 (13:12 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 7 Jun 2018 17:52:57 +0000 (19:52 +0200)
Fixes: left shift of negative value -9057
Fixes: 8527/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5666853924896768
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/shorten.c

index 8aeacfeb3163399a413557a6159d2fdf858176a2..f7475b49549c68864db3ebf6382d5773ace07489 100644 (file)
@@ -710,7 +710,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
                 if (s->version < 2)
                     s->offset[channel][s->nmean - 1] = sum / s->blocksize;
                 else
-                    s->offset[channel][s->nmean - 1] = s->bitshift == 32 ? 0 : (sum / s->blocksize) << s->bitshift;
+                    s->offset[channel][s->nmean - 1] = s->bitshift == 32 ? 0 : (sum / s->blocksize) * (1 << s->bitshift);
             }
 
             /* copy wrap samples for use with next block */