]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/ffwavesynth: Fix integer overflow in wavesynth_synth_sample / WS_SINE
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 5 Sep 2020 15:58:53 +0000 (17:58 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 7 Sep 2020 21:05:25 +0000 (23:05 +0200)
Fixes: signed integer overflow: -1429092 * -32596 cannot be represented in type 'int'
Fixes: 24419/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5157849974702080
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ffwavesynth.c

index 8d3ac81aefb36d9a48c4383159d3864b96e7e8bd..d92bb38c45071a29cc95c6826ffef49ecc4389ba 100644 (file)
@@ -373,7 +373,7 @@ static void wavesynth_synth_sample(struct wavesynth_context *ws, int64_t ts,
         in->amp  += in->damp;
         switch (in->type) {
             case WS_SINE:
-                val = amp * ws->sin[in->phi >> (64 - SIN_BITS)];
+                val = amp * (unsigned)ws->sin[in->phi >> (64 - SIN_BITS)];
                 in->phi  += in->dphi;
                 in->dphi += in->ddphi;
                 break;