aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-17 15:06:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-20 02:05:09 +0200
commite46f8c96d0c2964687a7da39cabdcc8e5d36dda2 (patch)
tree52cb241159e61b73ea460f60e984dd2b2a35c8b1 /libavcodec
parentfce334274bf5df2fce4fa3db958a936b5ad44e75 (diff)
downloadffmpeg-e46f8c96d0c2964687a7da39cabdcc8e5d36dda2.tar.gz
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> (cherry picked from commit c746f92a8e03d5a062359fba836eba4b3530687e) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/jpeg2000dsp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/jpeg2000dsp.c b/libavcodec/jpeg2000dsp.c
index d183cbb87d..c746aed924 100644
--- a/libavcodec/jpeg2000dsp.c
+++ b/libavcodec/jpeg2000dsp.c
@@ -64,10 +64,10 @@ static void ict_int(void *_src0, void *_src1, void *_src2, int csize)
int 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)
- (((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;
*src1++ = i1;
*src2++ = i2;