aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-01-31 23:43:57 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commitdad6714ce67a35bdbcfce0d23a1d0f1edea766f0 (patch)
tree930976e5c80c11e0b8a541b4aa6b6430c2e06edc
parent9727acaad55198cecc8d61c802eabef6e4e26221 (diff)
downloadffmpeg-dad6714ce67a35bdbcfce0d23a1d0f1edea766f0.tar.gz
avcodec/xvididct: Fix integer overflow in MULT()
Fixes: signed integer overflow: 23170 * 95058 cannot be represented in type 'int' Fixes: 20295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5800212870463488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 7ccb576191e91b393041b14917f1b681ec75ed3b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/xvididct.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/xvididct.c b/libavcodec/xvididct.c
index 1f96ccc35c..cf6963c282 100644
--- a/libavcodec/xvididct.c
+++ b/libavcodec/xvididct.c
@@ -142,7 +142,7 @@ static int idct_row(short *in, const int *const tab, int rnd)
#define TAN3 0xAB0E
#define SQRT2 0x5A82
-#define MULT(c, x, n) (((c) * (x)) >> (n))
+#define MULT(c, x, n) ((unsigned)((int)((c) * (unsigned)(x)) >> (n)))
// 12b version => #define MULT(c,x, n) ((((c) >> 3) * (x)) >> ((n) - 3))
// 12b zero-testing version: