aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/apedec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-09-29 20:53:53 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 18:34:49 +0200
commitc3971ff707bbcffd7838cd2e8ee48702d6b09f4c (patch)
treed932c7812ecd3450049398c8cd493e5013f7209c /libavcodec/apedec.c
parentca5f10e0c39729b6b5ea3cccc36032777a3b94f8 (diff)
downloadffmpeg-c3971ff707bbcffd7838cd2e8ee48702d6b09f4c.tar.gz
avcodec/apedec: Use 64bit to avoid overflow
Fixes: runtime error: signed integer overflow: 727298502 * 3 cannot be represented in type 'int' Fixes: 39172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-638602483033702 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 f059b56195da9c0e2c11a5f7f357a3d6101e6bf0) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/apedec.c')
-rw-r--r--libavcodec/apedec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 8a7ba73815..d05aa741ef 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1286,7 +1286,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
absres = res < 0 ? -(unsigned)res : res;
if (absres)
*f->adaptcoeffs = APESIGN(res) *
- (8 << ((absres > f->avg * 3) + (absres > (f->avg + f->avg / 3))));
+ (8 << ((absres > f->avg * 3LL) + (absres > (f->avg + f->avg / 3))));
/* equivalent to the following code
if (absres <= f->avg * 4 / 3)
*f->adaptcoeffs = APESIGN(res) * 8;