avcodec/mdec: Fix signed integer overflow: 28835400 * 83 cannot be represented in type 'int'

Fixes: 1346/clusterfuzz-testcase-minimized-5776732600664064

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 a234b5ade3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-05-05 22:17:59 +02:00
parent 5204a50013
commit 766c53f9e5
1 changed files with 2 additions and 2 deletions

View File

@ -112,11 +112,11 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
j = scantable[i];
if (level < 0) {
level = -level;
level = (level * qscale * quant_matrix[j]) >> 3;
level = (level * (unsigned)qscale * quant_matrix[j]) >> 3;
level = (level - 1) | 1;
level = -level;
} else {
level = (level * qscale * quant_matrix[j]) >> 3;
level = (level * (unsigned)qscale * quant_matrix[j]) >> 3;
level = (level - 1) | 1;
}
}