[FFmpeg-cvslog] avcodec/apedec: Fix integer overflow in predictor_decode_stereo_3950()

Michael Niedermayer git at videolan.org
Fri Nov 10 03:44:05 EET 2023


ffmpeg | branch: release/6.1 | Michael Niedermayer <michael at niedermayer.cc> | Fri Oct 20 18:20:14 2023 +0200| [c9a9dbfebf749f0fa8d938e6f64adaef438ea9f9] | committer: Michael Niedermayer

avcodec/apedec: Fix integer overflow in predictor_decode_stereo_3950()

Fixes: signed integer overflow: 1900031961 + 553590817 cannot be represented in type 'int'
Fixes: 63061/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5166188298371072

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

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

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

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 8bfbb75b41..d31c067152 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1284,7 +1284,7 @@ static void predictor_decode_stereo_3950(APEContext *ctx, int count)
             *decoded1++ = a1;
             if (num_passes > 1) {
                 int32_t left  = a1 - (unsigned)(a0 / 2);
-                int32_t right = left + a0;
+                int32_t right = left + (unsigned)a0;
 
                 if (FFMAX(FFABS(left), FFABS(right)) > (1<<23)) {
                     ctx->interim_mode = !interim_mode;



More information about the ffmpeg-cvslog mailing list