aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-02-18 00:11:33 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-02-27 19:59:58 +0100
commitafc85dacba4be4b91e2e1ca5df31f55fb94b44d6 (patch)
treecfbd9a64b6ae61e6ac49e4f047ec820cdf71c4e4
parentb4135fb335f0ab1f06996233f45610c3dcb85bb7 (diff)
downloadffmpeg-afc85dacba4be4b91e2e1ca5df31f55fb94b44d6.tar.gz
avcodec/jpeg2000dwt: Fix integer overflows in sr_1d53()
Fixes: 5918/clusterfuzz-testcase-minimized-5120505435652096 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 793347a54579ee954b58d336b82eed4a1786de21) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/jpeg2000dwt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/jpeg2000dwt.c b/libavcodec/jpeg2000dwt.c
index 38a578af3d..5a72335d91 100644
--- a/libavcodec/jpeg2000dwt.c
+++ b/libavcodec/jpeg2000dwt.c
@@ -305,22 +305,22 @@ static void dwt_encode97_int(DWTContext *s, int *t)
t[i] = (t[i] + ((1<<I_PRESHIFT)>>1)) >> I_PRESHIFT;
}
-static void sr_1d53(int *p, int i0, int i1)
+static void sr_1d53(unsigned *p, int i0, int i1)
{
int i;
if (i1 <= i0 + 1) {
if (i0 == 1)
- p[1] >>= 1;
+ p[1] = (int)p[1] >> 1;
return;
}
extend53(p, i0, i1);
for (i = (i0 >> 1); i < (i1 >> 1) + 1; i++)
- p[2 * i] -= (p[2 * i - 1] + p[2 * i + 1] + 2) >> 2;
+ p[2 * i] -= (int)(p[2 * i - 1] + p[2 * i + 1] + 2) >> 2;
for (i = (i0 >> 1); i < (i1 >> 1); i++)
- p[2 * i + 1] += (p[2 * i] + p[2 * i + 2]) >> 1;
+ p[2 * i + 1] += (int)(p[2 * i] + p[2 * i + 2]) >> 1;
}
static void dwt_decode53(DWTContext *s, int *t)