]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/wavpack.c
avcodec/wavpack: Fix integer overflow in wv_unpack_stereo()
[ffmpeg] / libavcodec / wavpack.c
index 0e40b29879959a4a003e27a60248fe2653dd76bb..22a2c83a30e731bed38eacb5dc1674cbc486ca79 100644 (file)
@@ -452,7 +452,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
                 if (type != AV_SAMPLE_FMT_S16P)
                     R2 = R + ((s->decorr[i].weightB * (int64_t)L2 + 512) >> 10);
                 else
-                    R2 = R + ((int)(s->decorr[i].weightB * (unsigned)L2 + 512) >> 10);
+                    R2 = R + (unsigned)((int)(s->decorr[i].weightB * (unsigned)L2 + 512) >> 10);
                 UPDATE_WEIGHT_CLIP(s->decorr[i].weightB, s->decorr[i].delta, L2, R);
                 R                        = R2;
                 s->decorr[i].samplesA[0] = R;