aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-11-18 14:22:57 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-04-23 21:29:01 +0200
commitdaf27acf721cf9733a210790044d99570363c3c0 (patch)
tree7970ab728ca47d15b272b7e0fb27de3e22d5b476 /libavcodec
parent758119ca41f049a916b2c37daed2950102b150c9 (diff)
downloadffmpeg-daf27acf721cf9733a210790044d99570363c3c0.tar.gz
avcodec/wmalosslessdec: Fix several integer issues
Fixes: shift exponent -1 is negative (and others) Fixes: 18852/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5660855295541248 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 ec3fe67074ad0a6a3a817f6f42175ea63a98092b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/wmalosslessdec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 9187e66da3..2b064e5f76 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -675,7 +675,7 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred)
for (i = 0; i < ich; i++)
pred[ich] += s->channel_residues[i][icoef] *
s->mclms_coeffs_cur[i + num_channels * ich];
- pred[ich] += 1 << s->mclms_scaling - 1;
+ pred[ich] += (1 << s->mclms_scaling) >> 1;
pred[ich] >>= s->mclms_scaling;
s->channel_residues[ich][icoef] += pred[ich];
}
@@ -803,19 +803,19 @@ static void revert_acfilter(WmallDecodeCtx *s, int tile_size)
pred = 0;
for (j = 0; j < order; j++) {
if (i <= j)
- pred += filter_coeffs[j] * prevvalues[j - i];
+ pred += (uint32_t)filter_coeffs[j] * prevvalues[j - i];
else
- pred += s->channel_residues[ich][i - j - 1] * filter_coeffs[j];
+ pred += (uint32_t)s->channel_residues[ich][i - j - 1] * filter_coeffs[j];
}
pred >>= scaling;
- s->channel_residues[ich][i] += pred;
+ s->channel_residues[ich][i] += (unsigned)pred;
}
for (i = order; i < tile_size; i++) {
pred = 0;
for (j = 0; j < order; j++)
pred += s->channel_residues[ich][i - j - 1] * filter_coeffs[j];
pred >>= scaling;
- s->channel_residues[ich][i] += pred;
+ s->channel_residues[ich][i] += (unsigned)pred;
}
for (j = 0; j < order; j++)
prevvalues[j] = s->channel_residues[ich][tile_size - j - 1];