[FFmpeg-devel] [PATCH 4/4] avcodec/apedec: Fix undefined integer overflow in decode_array_0000()

Michael Niedermayer michael at niedermayer.cc
Sun Dec 8 01:20:12 EET 2019


Fixes: signed integer overflow: -2143289344 - 6246400 cannot be represented in type 'int'
Fixes: 19239/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5173755680915456

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 2b5bd759f5..ebda288043 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -614,7 +614,7 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
             return ;
         }
         out[i] = get_rice_ook(&ctx->gb, rice->k);
-        rice->ksum += out[i] - out[i - 64];
+        rice->ksum += out[i] - (unsigned)out[i - 64];
         while (rice->ksum < ksummin) {
             rice->k--;
             ksummin = rice->k ? ksummin >> 1 : 0;
-- 
2.23.0



More information about the ffmpeg-devel mailing list