Commit 9cc926da authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/h264idct_template: Fix integer overflow in ff_h264_idct8_add

Fixes: signed integer overflow: 452986184 - -2113885312 cannot be represented in type 'int'
Fixes: 4196/clusterfuzz-testcase-minimized-5580648594014208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 3aad94bf
......@@ -76,10 +76,10 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
for( i = 0; i < 8; i++ )
{
const unsigned int a0 = block[i+0*8] + block[i+4*8];
const unsigned int a2 = block[i+0*8] - block[i+4*8];
const unsigned int a4 = (block[i+2*8]>>1) - block[i+6*8];
const unsigned int a6 = (block[i+6*8]>>1) + block[i+2*8];
const unsigned int a0 = block[i+0*8] + (unsigned)block[i+4*8];
const unsigned int a2 = block[i+0*8] - (unsigned)block[i+4*8];
const unsigned int a4 = (block[i+2*8]>>1) - (unsigned)block[i+6*8];
const unsigned int a6 = (block[i+6*8]>>1) + (unsigned)block[i+2*8];
const unsigned int b0 = a0 + a6;
const unsigned int b2 = a2 + a4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment