Commit 6e15ba2d authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/apedec: Fix 2 integer overflows

Fixes: signed integer overflow: 2119056926 - -134217728 cannot be represented in type 'int'
Fixes: 18728/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5747539563511808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent a9cbd25d
......@@ -1234,7 +1234,7 @@ static void predictor_decode_mono_3950(APEContext *ctx, int count)
p->buf = p->historybuffer;
}
p->filterA[0] = currentA + ((int)(p->filterA[0] * 31U) >> 5);
p->filterA[0] = currentA + (unsigned)((int)(p->filterA[0] * 31U) >> 5);
*(decoded0++) = p->filterA[0];
}
......@@ -1302,7 +1302,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
else
*f->adaptcoeffs = 0;
f->avg += (absres - f->avg) / 16;
f->avg += (int)(absres - (unsigned)f->avg) / 16;
f->adaptcoeffs[-1] >>= 1;
f->adaptcoeffs[-2] >>= 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment