[FFmpeg-cvslog] avcodec/apedec: Fix integer overflow in intermediate

Michael Niedermayer git at videolan.org
Wed Oct 6 13:20:46 EEST 2021


ffmpeg | branch: release/4.1 | Michael Niedermayer <michael at niedermayer.cc> | Wed Sep 15 22:00:47 2021 +0200| [25f9794e5633d423796c871669472d97da17e0d5] | committer: Michael Niedermayer

avcodec/apedec: Fix integer overflow in intermediate

Fixes: signed integer overflow: 559334865 * 4 cannot be represented in type 'int'
Fixes: 37929/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6751932295806976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 90da43557f7257d72e95504f63ae6504406d6eab)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=25f9794e5633d423796c871669472d97da17e0d5
---

 libavcodec/apedec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index e11ee0a708..7db1196d3f 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 * 4 / 3)));
+                                  (8 << ((absres > f->avg * 3) + (absres > (f->avg + f->avg / 3))));
                 /* equivalent to the following code
                     if (absres <= f->avg * 4 / 3)
                         *f->adaptcoeffs = APESIGN(res) * 8;



More information about the ffmpeg-cvslog mailing list