]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/apedec: Fix undefined integer overflow in decode_array_0000()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 7 Dec 2019 19:55:16 +0000 (20:55 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 30 Jan 2020 18:58:15 +0000 (19:58 +0100)
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@niedermayer.cc>
libavcodec/apedec.c

index 1b23e541531147f264f38e73991a7ee1ca82b433..3e39a8e62e8de7c4d5eec77c861750e3bd0442b4 100644 (file)
@@ -615,7 +615,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;