diff mbox series

[FFmpeg-devel,1/2] avcodec/ffwavesynth: Fix integer overflow in wavesynth_synth_sample / WS_SINE

Message ID 20200906132617.13188-1-michael@niedermayer.cc
State Accepted
Commit a0da95df77a528251a326fc8b7e2ff48c60e41d0
Headers show
Series [FFmpeg-devel,1/2] avcodec/ffwavesynth: Fix integer overflow in wavesynth_synth_sample / WS_SINE | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer Sept. 6, 2020, 1:26 p.m. UTC
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
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/ffwavesynth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas George Sept. 6, 2020, 5:38 p.m. UTC | #1
Michael Niedermayer (12020-09-06):
> 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
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ffwavesynth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Ok.

Regards,
Michael Niedermayer Sept. 7, 2020, 10:09 p.m. UTC | #2
On Sun, Sep 06, 2020 at 07:38:07PM +0200, Nicolas George wrote:
> Michael Niedermayer (12020-09-06):
> > 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
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/ffwavesynth.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Ok.

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c
index 8d3ac81aef..d92bb38c45 100644
--- a/libavcodec/ffwavesynth.c
+++ b/libavcodec/ffwavesynth.c
@@ -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;