Browse Source

avcodec/ra144: Fix integer overflow in ff_eval_refl()

Fixes: signed integer overflow: -4096 * -524288 cannot be represented in type 'int'
Fixes: 8650/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RA_144_fuzzer-5734816036159488

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 b31189881a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.3.8
Michael Niedermayer 7 years ago
parent
commit
eedde18f1a
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/ra144.c

+ 2
- 2
libavcodec/ra144.c View File

@@ -1569,11 +1569,11 @@ int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx)
b = 0x1000000 / b;
for (j=0; j <= i; j++) {
#if CONFIG_FTRAPV
int a = bp2[j] - ((refl[i+1] * bp2[i-j]) >> 12);
int a = bp2[j] - ((int)(refl[i+1] * (unsigned)bp2[i-j]) >> 12);
if((int)(a*(unsigned)b) != a*(int64_t)b)
return 1;
#endif
bp1[j] = (int)((bp2[j] - ((refl[i+1] * bp2[i-j]) >> 12)) * (unsigned)b) >> 12;
bp1[j] = (int)((bp2[j] - ((int)(refl[i+1] * (unsigned)bp2[i-j]) >> 12)) * (unsigned)b) >> 12;
}

if ((unsigned) bp1[i] + 0x1000 > 0x1fff)


Loading…
Cancel
Save