]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/wmavoice: Fix integer overflow in synth_frame()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 2 Nov 2019 14:15:46 +0000 (15:15 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 24 Nov 2019 22:00:25 +0000 (23:00 +0100)
Fixes: left shift of negative value -3
Fixes: 18518/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-6560514359951360
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/wmavoice.c

index 4c147fe04fcb9908593b19925d251105c059ff57..5dd9b3dbb7a8cb4d89e10a1fa30113e69549850e 100644 (file)
@@ -1523,7 +1523,7 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx,
 
         /* "pitch-diff-per-sample" for calculation of pitch per sample */
         s->pitch_diff_sh16 =
-            ((cur_pitch_val - s->last_pitch_val) << 16) / MAX_FRAMESIZE;
+            (cur_pitch_val - s->last_pitch_val) * (1 << 16) / MAX_FRAMESIZE;
     }
 
     /* Global gain (if silence) and pitch-adaptive window coordinates */