avcodec/hqxdsp: Fix runtime error: signed integer overflow: -196264 * 11585 cannot...
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 May 2017 12:06:56 +0000 (14:06 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 May 2017 13:30:08 +0000 (15:30 +0200)
Fixes: 1568/clusterfuzz-testcase-minimized-5944868608147456

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

index 04a65e7..7f8044e 100644 (file)
@@ -47,8 +47,8 @@ static inline void idct_col(int16_t *blk, const uint8_t *quant)
     t5  = t1 * 2 + t3;
     t6  = t2 - t3;
     t7  = t3 * 2 + t6;
-    t8  = (t6 * 11585) >> 14;
-    t9  = (t7 * 11585) >> 14;
+    t8  = (int)(t6 * 11585U) >> 14;
+    t9  = (int)(t7 * 11585U) >> 14;
     tA  = (int)(s2 * 8867U - s6 * 21407U) >> 14;
     tB  = (int)(s6 * 8867U + s2 * 21407U) >> 14;
     tC  = (s0 >> 1) - (s4 >> 1);