Browse Source

avcodec/apedec: Fix undefined integer overflow in decode_array_0000()

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>
(cherry picked from commit a3655bb02c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.8.16
Michael Niedermayer 6 years ago
parent
commit
cee643d7fb
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavcodec/apedec.c

+ 1
- 1
libavcodec/apedec.c View File

@@ -610,7 +610,7 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
ksummin = rice->k ? (1 << rice->k + 6) : 0; ksummin = rice->k ? (1 << rice->k + 6) : 0;
for (; i < blockstodecode; i++) { for (; i < blockstodecode; i++) {
out[i] = get_rice_ook(&ctx->gb, rice->k); 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) { while (rice->ksum < ksummin) {
rice->k--; rice->k--;
ksummin = rice->k ? ksummin >> 1 : 0; ksummin = rice->k ? ksummin >> 1 : 0;


Loading…
Cancel
Save