]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ffwavesynth.c
avcodec/ffwavesynth: Fix integer overflow in computation of ddphi
[ffmpeg] / libavcodec / ffwavesynth.c
index b9c63abb8d9e3d8070f71241a02520ec32f5ddeb..998e1a4ad66e0963a1bc90cb6df2053193d4a981 100644 (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)