]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/adpcm: Fix left shifts in AV_CODEC_ID_ADPCM_EA
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 27 Sep 2019 10:04:57 +0000 (12:04 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 16 Oct 2019 17:17:57 +0000 (19:17 +0200)
Fixes: left shift of negative value -1
Fixes: 17683/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_EA_R2_fuzzer-5111690013704192
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/adpcm.c

index 7f2ebfc99d9ace9a23763d6b51aba457db1516c7..8ed2b6c9d97aad6c8579d56ca98be0f37197abb2 100644 (file)
@@ -1380,10 +1380,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
 
                     for (count2=0; count2<28; count2++) {
                         if (count2 & 1)
-                            next_sample = sign_extend(byte,    4) << shift;
+                            next_sample = (unsigned)sign_extend(byte,    4) << shift;
                         else {
                             byte = bytestream2_get_byte(&gb);
-                            next_sample = sign_extend(byte >> 4, 4) << shift;
+                            next_sample = (unsigned)sign_extend(byte >> 4, 4) << shift;
                         }
 
                         next_sample += (current_sample  * coeff1) +