diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-08-01 19:56:07 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-09-10 01:33:28 +0200 |
commit | ef8db67c92953e6222e0b42d8fbef4c70e1cba68 (patch) | |
tree | f117938ea1060a19cc7ff8064482d095ef30df22 | |
parent | c55478835275240d67c8af9b22de2ecb7e65e444 (diff) | |
download | ffmpeg-ef8db67c92953e6222e0b42d8fbef4c70e1cba68.tar.gz |
avcodec/h264idct_template: Fix integer overflow in ff_h264_idct_add()
Fixes: runtime error: signed integer overflow: 26215360 + 2121330944 cannot be represented in type 'int'
Fixes: 2809/clusterfuzz-testcase-minimized-4785181833560064
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
(cherry picked from commit d1bfa80ec464d475a0de3f513bbb62bcd356099a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/h264idct_template.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c index e1ef68756c..288107d5a4 100644 --- a/libavcodec/h264idct_template.c +++ b/libavcodec/h264idct_template.c @@ -40,10 +40,10 @@ void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride) block[0] += 1 << 5; for(i=0; i<4; i++){ - const SUINT z0= block[i + 4*0] + block[i + 4*2]; - const SUINT z1= block[i + 4*0] - block[i + 4*2]; - const SUINT z2= (block[i + 4*1]>>1) - block[i + 4*3]; - const SUINT z3= block[i + 4*1] + (block[i + 4*3]>>1); + const SUINT z0= block[i + 4*0] + (unsigned)block[i + 4*2]; + const SUINT z1= block[i + 4*0] - (unsigned)block[i + 4*2]; + const SUINT z2= (block[i + 4*1]>>1) - (unsigned)block[i + 4*3]; + const SUINT z3= block[i + 4*1] + (unsigned)(block[i + 4*3]>>1); block[i + 4*0]= z0 + z3; block[i + 4*1]= z1 + z2; |