OSDN Git Service

avcodec/wmv2dsp: Fix runtime error: signed integer overflow: 181 * -17047030 cannot...
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 12 May 2017 11:05:46 +0000 (13:05 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 12 May 2017 11:40:59 +0000 (13:40 +0200)
Fixes: 1503/clusterfuzz-testcase-minimized-5369271855087616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/wmv2dsp.c

index 7a3a851..543f01b 100644 (file)
@@ -48,8 +48,8 @@ static void wmv2_idct_row(short * b)
     a4 = W0 * b[0] - W0 * b[4];
 
     /* step 2 */
-    s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8; // 1, 3, 5, 7
-    s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8;
+    s1 = (int)(181U * (a1 - a5 + a7 - a3) + 128) >> 8; // 1, 3, 5, 7
+    s2 = (int)(181U * (a1 - a5 - a7 + a3) + 128) >> 8;
 
     /* step 3 */
     b[0] = (a0 + a2 + a1 + a5 + (1 << 7)) >> 8;