aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-10-30 23:21:41 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-12-30 21:11:31 +0100
commit6fb7e324fee1b26f5c0ff41eab81c0a0ddd49fe5 (patch)
treea3c4cbb06cd71e0e52d2c434a05cfb8c0b92f914
parentfaa84a0c0667927b89f20f8c5af64129ccbb18ef (diff)
downloadffmpeg-6fb7e324fee1b26f5c0ff41eab81c0a0ddd49fe5.tar.gz
avcodec/h264idct_template: Fix integer overflows in ff_h264_idct8_add()
Fixes: runtime error: signed integer overflow: 924846844 + 1457520640 cannot be represented in type 'int' Fixes: 3416/clusterfuzz-testcase-minimized-6125587682820096 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 2b739e1cb8f6ce8baead03ce5c999103ba78f24f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/h264idct_template.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c
index 288107d5a4..ec8a3d083a 100644
--- a/libavcodec/h264idct_template.c
+++ b/libavcodec/h264idct_template.c
@@ -107,10 +107,10 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){
}
for( i = 0; i < 8; i++ )
{
- const unsigned a0 = block[0+i*8] + block[4+i*8];
- const unsigned a2 = block[0+i*8] - block[4+i*8];
- const unsigned a4 = (block[2+i*8]>>1) - block[6+i*8];
- const unsigned a6 = (block[6+i*8]>>1) + block[2+i*8];
+ const unsigned a0 = block[0+i*8] + (unsigned)block[4+i*8];
+ const unsigned a2 = block[0+i*8] - (unsigned)block[4+i*8];
+ const unsigned a4 = (block[2+i*8]>>1) - (unsigned)block[6+i*8];
+ const unsigned a6 = (block[6+i*8]>>1) + (unsigned)block[2+i*8];
const unsigned b0 = a0 + a6;
const unsigned b2 = a2 + a4;