]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mv30: Fix integer overflows in idct2_1d()
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 18 Jun 2020 09:52:47 +0000 (11:52 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 2 Jul 2020 15:18:55 +0000 (17:18 +0200)
Fixes: signed integer overflow: 6500736 * 473 cannot be represented in type 'int'
Fixes: 23259/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5179394271477760
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mv30.c

index 76b9170eafb3e7ec1a5ea145c772f6f0af07fb8b..c83ba7ffbdb79794ae5be853491221b3b1e7b6dc 100644 (file)
@@ -200,10 +200,10 @@ static inline void idct2_1d(int *blk, int step)
 {
     const int t0 = blk[0 * step];
     const int t1 = blk[1 * step];
-    const int t2 = t1 * 473 >> 8;
+    const int t2 = (int)(t1 * 473U) >> 8;
     const int t3 = t2 - t1;
-    const int t4 = (t1 * 362 >> 8) - t3;
-    const int t5 = ((t1 * 277 >> 8) - t2) + t4;
+    const int t4 =  ((int)(t1 * 362U) >> 8) - t3;
+    const int t5 = (((int)(t1 * 277U) >> 8) - t2) + t4;
 
     blk[0 * step] = t1 + t0;
     blk[1 * step] = t0 + t3;