diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-02-22 22:07:35 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-02-22 22:29:03 +0100 |
commit | ec849f637e8548ec6c9b6329334944c7c81df443 (patch) | |
tree | 8271477750f396545a4c40be8f1f66a361334370 /libavcodec/h264idct_template.c | |
parent | 6871df02d973c9ffc1aa4f6d08fb4b1b63d411be (diff) | |
download | ffmpeg-ec849f637e8548ec6c9b6329334944c7c81df443.tar.gz |
avcodec/h264idct_template: Fix several runtime error: signed integer overflow
Fixes: 652/clusterfuzz-testcase-6174944410992640
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264idct_template.c')
-rw-r--r-- | libavcodec/h264idct_template.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c index a90c407388..c00900b658 100644 --- a/libavcodec/h264idct_template.c +++ b/libavcodec/h264idct_template.c @@ -289,15 +289,15 @@ void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){ for(i=0; i<2; i++){ const int offset= x_offset[i]; - const int z0= temp[2*0+i] + temp[2*2+i]; - const int z1= temp[2*0+i] - temp[2*2+i]; - const int z2= temp[2*1+i] - temp[2*3+i]; - const int z3= temp[2*1+i] + temp[2*3+i]; - - block[stride*0+offset]= ((z0 + z3)*qmul + 128) >> 8; - block[stride*1+offset]= ((z1 + z2)*qmul + 128) >> 8; - block[stride*2+offset]= ((z1 - z2)*qmul + 128) >> 8; - block[stride*3+offset]= ((z0 - z3)*qmul + 128) >> 8; + const SUINT z0= temp[2*0+i] + temp[2*2+i]; + const SUINT z1= temp[2*0+i] - temp[2*2+i]; + const SUINT z2= temp[2*1+i] - temp[2*3+i]; + const SUINT z3= temp[2*1+i] + temp[2*3+i]; + + block[stride*0+offset]= (int)((z0 + z3)*qmul + 128) >> 8; + block[stride*1+offset]= (int)((z1 + z2)*qmul + 128) >> 8; + block[stride*2+offset]= (int)((z1 - z2)*qmul + 128) >> 8; + block[stride*3+offset]= (int)((z0 - z3)*qmul + 128) >> 8; } } |