mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/jpeg2000dsp: Reorder operations in ict_int() to avoid 2 integer overflows
Fixes: runtime error: signed integer overflow: 58065 * 51981 cannot be represented in type 'int' Fixes: 2271/clusterfuzz-testcase-minimized-5778297776504832 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
c94326c1fc
commit
c746f92a8e
|
@ -64,10 +64,10 @@ static void ict_int(void *_src0, void *_src1, void *_src2, int csize)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < csize; i++) {
|
for (i = 0; i < csize; i++) {
|
||||||
i0 = *src0 + (((i_ict_params[0] * *src2) + (1 << 15)) >> 16);
|
i0 = *src0 + *src2 + (((26345 * *src2) + (1 << 15)) >> 16);
|
||||||
i1 = *src0 - (((i_ict_params[1] * *src1) + (1 << 15)) >> 16)
|
i1 = *src0 - (((i_ict_params[1] * *src1) + (1 << 15)) >> 16)
|
||||||
- (((i_ict_params[2] * *src2) + (1 << 15)) >> 16);
|
- (((i_ict_params[2] * *src2) + (1 << 15)) >> 16);
|
||||||
i2 = *src0 + (((i_ict_params[3] * *src1) + (1 << 15)) >> 16);
|
i2 = *src0 + (2 * *src1) + (((-14942 * *src1) + (1 << 15)) >> 16);
|
||||||
*src0++ = i0;
|
*src0++ = i0;
|
||||||
*src1++ = i1;
|
*src1++ = i1;
|
||||||
*src2++ = i2;
|
*src2++ = i2;
|
||||||
|
|
Loading…
Reference in New Issue