mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-12 02:04:58 +00:00
avcodec/ffwavesynth: Fix integer overflows in pink noise addition
Fixes: signed integer overflow: -1795675744 + -1926578528 cannot be represented in type 'int'
Fixes: 17741/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5131336402075648
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 7916b6863c
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
36ba4471d4
commit
6496bfcc65
@ -377,7 +377,7 @@ static void wavesynth_synth_sample(struct wavesynth_context *ws, int64_t ts,
|
|||||||
in->dphi += in->ddphi;
|
in->dphi += in->ddphi;
|
||||||
break;
|
break;
|
||||||
case WS_NOISE:
|
case WS_NOISE:
|
||||||
val = amp * pink;
|
val = amp * (unsigned)pink;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
val = 0;
|
val = 0;
|
||||||
@ -385,7 +385,7 @@ static void wavesynth_synth_sample(struct wavesynth_context *ws, int64_t ts,
|
|||||||
all_ch |= in->channels;
|
all_ch |= in->channels;
|
||||||
for (c = in->channels, cv = channels; c; c >>= 1, cv++)
|
for (c = in->channels, cv = channels; c; c >>= 1, cv++)
|
||||||
if (c & 1)
|
if (c & 1)
|
||||||
*cv += val;
|
*cv += (unsigned)val;
|
||||||
}
|
}
|
||||||
val = (int32_t)lcg_next(&ws->dither_state) >> 16;
|
val = (int32_t)lcg_next(&ws->dither_state) >> 16;
|
||||||
for (c = all_ch, cv = channels; c; c >>= 1, cv++)
|
for (c = all_ch, cv = channels; c; c >>= 1, cv++)
|
||||||
|
Loading…
Reference in New Issue
Block a user