summaryrefslogtreecommitdiff
path: root/libavcodec/takdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-20 17:52:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-22 21:20:04 +0200
commit64d0dad93c18a517e92d152fdf7cbf92f1cf0a68 (patch)
treec3fe556844d868ff4de8d212d2fcc7278caa2d8b /libavcodec/takdec.c
parent42e42af76cff46c4e1a41dd8de992b38880f78be (diff)
downloadffmpeg-64d0dad93c18a517e92d152fdf7cbf92f1cf0a68.tar.gz
avcodec/takdec: Fix multiple runtime error: signed integer overflow: -512 * 4563386 cannot be represented in type 'int'
Fixes: 1706/clusterfuzz-testcase-minimized-6112772670619648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/takdec.c')
-rw-r--r--libavcodec/takdec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 85ef56644b..081b2f203b 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -447,12 +447,12 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
tfilter[0] = s->predictors[0] * 64;
for (i = 1; i < filter_order; i++) {
- int32_t *p1 = &tfilter[0];
- int32_t *p2 = &tfilter[i - 1];
+ uint32_t *p1 = &tfilter[0];
+ uint32_t *p2 = &tfilter[i - 1];
for (j = 0; j < (i + 1) / 2; j++) {
- x = *p1 + (s->predictors[i] * *p2 + 256 >> 9);
- *p2 += s->predictors[i] * *p1 + 256 >> 9;
+ x = *p1 + ((int32_t)(s->predictors[i] * *p2 + 256) >> 9);
+ *p2 += (int32_t)(s->predictors[i] * *p1 + 256) >> 9;
*p1++ = x;
p2--;
}