Browse code

avcodec/wmv2dsp: Fix runtime error: signed integer overflow: 181 * -12156865 cannot be represented in type 'int'

Fixes: 1401/clusterfuzz-testcase-minimized-6526248148795392

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

Michael Niedermayer authored on 2017/05/08 06:07:42
Showing 1 changed files
... ...
@@ -78,8 +78,8 @@ static void wmv2_idct_col(short * b)
78 78
     a4 = (W0 * b[8 * 0] - W0 * b[8 * 4]    ) >> 3;
79 79
 
80 80
     /* step 2 */
81
-    s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8;
82
-    s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8;
81
+    s1 = (int)(181U * (a1 - a5 + a7 - a3) + 128) >> 8;
82
+    s2 = (int)(181U * (a1 - a5 - a7 + a3) + 128) >> 8;
83 83
 
84 84
     /* step 3 */
85 85
     b[8 * 0] = (a0 + a2 + a1 + a5 + (1 << 13)) >> 14;