avcodec/ffwavesynth: Fix integer overflow in computation of ddphi

Fixes: signed integer overflow: 1302123111085380114 - -8319005078741256972 cannot be represented in type 'long'
Fixes: 20991/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5148554161291264

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 c85bf16318)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-03-15 18:25:56 +01:00
parent a3a3730b54
commit e121488dc8
1 changed files with 1 additions and 1 deletions

View File

@ -281,7 +281,7 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
dphi1 = frac64(f1, (int64_t)avc->sample_rate << 16);
dphi2 = frac64(f2, (int64_t)avc->sample_rate << 16);
in->dphi0 = dphi1;
in->ddphi = (dphi2 - dphi1) / dt;
in->ddphi = (int64_t)(dphi2 - (uint64_t)dphi1) / dt;
if (phi & 0x80000000) {
phi &= ~0x80000000;
if (phi >= i)