[FFmpeg-devel] [PATCH 2/4] avcodec/apedec: Use 64bit in 4/3 calculation in do_apply_filter()
Michael Niedermayer
michael at niedermayer.cc
Fri Dec 3 19:19:54 EET 2021
Fixes: Integer overflow
Fixes: 40973/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6739312704618496
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/apedec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 9c723f29977..5c3261cf5cb 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1337,7 +1337,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
absres = FFABSU(res);
if (absres)
*f->adaptcoeffs = APESIGN(res) *
- (8 << ((absres > f->avg * 3LL) + (absres > (f->avg + f->avg / 3))));
+ (8 << ((absres > f->avg * 3LL) + (absres > ((int64_t)f->avg + f->avg / 3))));
/* equivalent to the following code
if (absres <= f->avg * 4 / 3)
*f->adaptcoeffs = APESIGN(res) * 8;
--
2.17.1
More information about the ffmpeg-devel
mailing list