Commit 2898bc52 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/h264idct_template: fix multiple runtime error: signed integer overflow

Fixes: 857/clusterfuzz-testcase-5319093760557056

Benchmark changes from 335->333 (so if its not a random fluctuation then it would be faster)

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 21bed3c9
...@@ -304,7 +304,7 @@ void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){ ...@@ -304,7 +304,7 @@ void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){
void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){ void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){
const int stride= 16*2; const int stride= 16*2;
const int xStride= 16; const int xStride= 16;
int a,b,c,d,e; SUINT a,b,c,d,e;
dctcoef *block = (dctcoef*)_block; dctcoef *block = (dctcoef*)_block;
a= block[stride*0 + xStride*0]; a= block[stride*0 + xStride*0];
...@@ -317,8 +317,8 @@ void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){ ...@@ -317,8 +317,8 @@ void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){
b= c-d; b= c-d;
c= c+d; c= c+d;
block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7; block[stride*0 + xStride*0]= (int)((a+c)*qmul) >> 7;
block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7; block[stride*0 + xStride*1]= (int)((e+b)*qmul) >> 7;
block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7; block[stride*1 + xStride*0]= (int)((a-c)*qmul) >> 7;
block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7; block[stride*1 + xStride*1]= (int)((e-b)*qmul) >> 7;
} }
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