aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-03-05 20:27:50 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-10 16:04:26 +0200
commit188f48b6d49f6ce8e893ca49ad650d2a68dfd471 (patch)
treedf552f2bbb0d1380017f4ca87435d04922b451d8
parent7ef5814e0fc12ccf21c745cfde8404510d342f7c (diff)
downloadffmpeg-188f48b6d49f6ce8e893ca49ad650d2a68dfd471.tar.gz
avcodec/ffwavesynth: Avoid signed integer overflow in phi_at()
Fixes: signed integer overflow: 2314885530818453536 - -9070214327174160352 cannot be represented in type 'long' Fixes: 31000/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-6558389742206976 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> (cherry picked from commit be08b84f8bb7acc0c45800c7f488399327a22961) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/ffwavesynth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c
index d92bb38c45..a7bb351ee5 100644
--- a/libavcodec/ffwavesynth.c
+++ b/libavcodec/ffwavesynth.c
@@ -188,7 +188,7 @@ static uint64_t frac64(uint64_t a, uint64_t b)
static uint64_t phi_at(struct ws_interval *in, int64_t ts)
{
- uint64_t dt = ts - in->ts_start;
+ uint64_t dt = ts - (uint64_t)in->ts_start;
uint64_t dt2 = dt & 1 ? /* dt * (dt - 1) / 2 without overflow */
dt * ((dt - 1) >> 1) : (dt >> 1) * (dt - 1);
return in->phi0 + dt * in->dphi0 + dt2 * in->ddphi;