[FFmpeg-cvslog] avcodec/apedec: Fixes integer overflow of res+*data in do_apply_filter()

Michael Niedermayer git at videolan.org
Sat Nov 23 00:30:32 EET 2019


ffmpeg | branch: release/3.4 | Michael Niedermayer <michael at niedermayer.cc> | Tue Oct 29 18:30:07 2019 +0100| [5222756b36fe2172903e1e165deb7c05cb34b025] | committer: Michael Niedermayer

avcodec/apedec: Fixes integer overflow of res+*data in do_apply_filter()

Fixes: signed integer overflow: 7400 + 2147482786 cannot be represented in type 'int'
Fixes: 18405/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5708834760294400

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 dc3f327e7403a34c88a900f0b8de55b4afd7cf6c)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 0c0c22b18a..7d07f5f8f1 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1268,7 +1268,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
                                                      f->adaptcoeffs - order,
                                                      order, APESIGN(*data));
         res = (int)(res + (1U << (fracbits - 1))) >> fracbits;
-        res += *data;
+        res += (unsigned)*data;
         *data++ = res;
 
         /* Update the output history */



More information about the ffmpeg-cvslog mailing list