aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-07 03:16:53 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-14 12:20:15 +0200
commita3e3d72d122a0c34da89c9f2b1afb57cabdb0ac9 (patch)
tree78466c4a7f95c7b3b3c0b4d4c91ba8ab2c430cf0
parent89e26447fa874cd8ded96f9170525d53a01433d3 (diff)
downloadffmpeg-a3e3d72d122a0c34da89c9f2b1afb57cabdb0ac9.tar.gz
avcodec/svq3: Fix multiple runtime error: signed integer overflow: 44161 * 61694 cannot be represented in type 'int'
Fixes: 1382/clusterfuzz-testcase-minimized-6013445293998080 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 669419939c1d36be35196859dc73ec9a194157ad) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/svq3.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 0e0eda3a45..1dd10a1a04 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -223,7 +223,7 @@ static int svq3_decode_end(AVCodecContext *avctx);
static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)
{
- const int qmul = svq3_dequant_coeff[qp];
+ const unsigned qmul = svq3_dequant_coeff[qp];
#define stride 16
int i;
int temp[16];
@@ -248,10 +248,10 @@ static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)
const int z2 = 7 * temp[4 * 1 + i] - 17 * temp[4 * 3 + i];
const int z3 = 17 * temp[4 * 1 + i] + 7 * temp[4 * 3 + i];
- output[stride * 0 + offset] = (z0 + z3) * qmul + 0x80000 >> 20;
- output[stride * 2 + offset] = (z1 + z2) * qmul + 0x80000 >> 20;
- output[stride * 8 + offset] = (z1 - z2) * qmul + 0x80000 >> 20;
- output[stride * 10 + offset] = (z0 - z3) * qmul + 0x80000 >> 20;
+ output[stride * 0 + offset] = (int)((z0 + z3) * qmul + 0x80000) >> 20;
+ output[stride * 2 + offset] = (int)((z1 + z2) * qmul + 0x80000) >> 20;
+ output[stride * 8 + offset] = (int)((z1 - z2) * qmul + 0x80000) >> 20;
+ output[stride * 10 + offset] = (int)((z0 - z3) * qmul + 0x80000) >> 20;
}
}
#undef stride