aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vc1_block.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-11-08 18:31:02 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 11:30:44 +0100
commit54c0706a2de6c7fc35c694f3e231be165c1599fb (patch)
treee82160473bc79df6ede8bcb50c7d7421bc33525d /libavcodec/vc1_block.c
parent600e1df9a58cb19c184c97189bce103ce8eb1124 (diff)
downloadffmpeg-54c0706a2de6c7fc35c694f3e231be165c1599fb.tar.gz
avcodec/vc1_block: Fix integer overflow in AC rescaling in vc1_decode_i_block_adv()
Fixes: signed integer overflow: 50176 * 262144 cannot be represented in type 'int' Fixes: 18629/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5182370286403584 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 0e010e489b70c044a67c47083cf8eb03209ee89f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/vc1_block.c')
-rw-r--r--libavcodec/vc1_block.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index da0eee8cc7..5fbf7b3b4b 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -889,7 +889,7 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n,
q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1;
if (q2 && q1 != q2) {
for (k = 1; k < 8; k++)
- ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
+ ac_val2[k] = (int)(ac_val2[k] * q2 * (unsigned)ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
for (k = 1; k < 8; k++) {
block[k << sh] = ac_val2[k] * scale;