[FFmpeg-cvslog] avcodec/apedec: Fix 32bit int overflow in do_apply_filter()

Michael Niedermayer git at videolan.org
Sat Sep 7 00:38:34 EEST 2019


ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Mon Sep  2 22:44:50 2019 +0200| [ee89d9e3d6ee2023d5827ff26f32030ee013c41d] | committer: Michael Niedermayer

avcodec/apedec: Fix 32bit int overflow in do_apply_filter()

Fixes: signed integer overflow: 2147480546 + 4096 cannot be represented in type 'int'
Fixes: 16280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5123442566758400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <tjoppen at acc.umu.se>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 9d3ddef519e88c40c05be8cb94cd9e71c0957ec7)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index b9df8c6b12..59e829ee5b 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1266,7 +1266,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
                                                      f->delay - order,
                                                      f->adaptcoeffs - order,
                                                      order, APESIGN(*data));
-        res = (res + (1 << (fracbits - 1))) >> fracbits;
+        res = (int)(res + (1U << (fracbits - 1))) >> fracbits;
         res += *data;
         *data++ = res;
 



More information about the ffmpeg-cvslog mailing list