Browse code

avcodec/wmavoice: Fix integer overflow in synth_frame()

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>
(cherry picked from commit cf323f4d38f5756ecdb8fb4f72c80a8069da832e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2019/11/02 23:15:46
Showing 1 changed files
... ...
@@ -1519,7 +1519,7 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx,
1519 1519
 
1520 1520
         /* "pitch-diff-per-sample" for calculation of pitch per sample */
1521 1521
         s->pitch_diff_sh16 =
1522
-            ((cur_pitch_val - s->last_pitch_val) << 16) / MAX_FRAMESIZE;
1522
+            (cur_pitch_val - s->last_pitch_val) * (1 << 16) / MAX_FRAMESIZE;
1523 1523
     }
1524 1524
 
1525 1525
     /* Global gain (if silence) and pitch-adaptive window coordinates */