aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-12-09 02:26:18 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-01-21 07:53:26 +0100
commit5550946ff4bdb4f6092e6aabd8d11888695ffbd0 (patch)
treec843da59318685c956fa9319f94d38911ddbfd24
parentdaef9d43828733534267dd15975f761ce7277a5b (diff)
downloadffmpeg-5550946ff4bdb4f6092e6aabd8d11888695ffbd0.tar.gz
avcodec/ilbcdec: fix integer overflow in energy
webrtc uses a int32_t like the existing code in ilbcdec Fixes: signed integer overflow: 2080245063 + 257939661 cannot be represented in type 'int' Fixes: 11037/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ILBC_fuzzer-5682976612941824 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 fbf409cd91aca2b4738c6b5bc963ae6041f26701) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/ilbcdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/ilbcdec.c b/libavcodec/ilbcdec.c
index 8a6dbe0b75..50012c0231 100644
--- a/libavcodec/ilbcdec.c
+++ b/libavcodec/ilbcdec.c
@@ -1303,7 +1303,8 @@ static int xcorr_coeff(int16_t *target, int16_t *regressor,
pos += step;
/* Do a +/- to get the next energy */
- energy += step * ((*rp_end * *rp_end - *rp_beg * *rp_beg) >> shifts);
+ energy += (unsigned)step * ((*rp_end * *rp_end - *rp_beg * *rp_beg) >> shifts);
+
rp_beg += step;
rp_end += step;
}