aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-06-05 13:19:35 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-07-10 01:52:56 +0200
commit6fdc61b8f6f1a8f7ded6fa858dd5b5fe69e0237e (patch)
tree4391b4eadc874c892367ae973f8263f15f1ceecb
parentf41da2bd5ff7d9d6b1141284dbd526d8b232e29b (diff)
downloadffmpeg-6fdc61b8f6f1a8f7ded6fa858dd5b5fe69e0237e.tar.gz
avcodec/shorten: Fix multiple integer overflows
Fixes: signed integer overflow: 3 * 1006632960 cannot be represented in type 'int' Fixes: 8278/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5692857166856192 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 f2abd36b3863188894fd21964c662b6c17268bfb) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/shorten.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index b8a5664ce9..cbd8a78bc4 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -313,7 +313,7 @@ static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
for (i = 0; i < s->blocksize; i++) {
sum = init_sum;
for (j = 0; j < pred_order; j++)
- sum += coeffs[j] * s->decoded[channel][i - j - 1];
+ sum += coeffs[j] * (unsigned)s->decoded[channel][i - j - 1];
s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) +
(sum >> qshift);
}
@@ -593,7 +593,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
/* update means with info from the current block */
if (s->nmean > 0) {
- int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
+ int64_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
for (i = 0; i < s->blocksize; i++)
sum += s->decoded[channel][i];