summaryrefslogtreecommitdiff
path: root/libavcodec/wmalosslessdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-05-16 13:14:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-06-06 02:24:22 +0200
commitbacc4b6e8173fa944c24f297435dc507a60efb10 (patch)
tree1e383d29b179794842bc27a2f240bbd5fb03a003 /libavcodec/wmalosslessdec.c
parent5a8b41b4a76fc6586ff6afff78e5f0aa7b25068a (diff)
downloadffmpeg-bacc4b6e8173fa944c24f297435dc507a60efb10.tar.gz
avcodec/wmalosslessdec: Use unsigned operations for overflowing cases
Fixes undefined behavior in fate-lossless-wma24-2 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/wmalosslessdec.c')
-rw-r--r--libavcodec/wmalosslessdec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 1ea5918b1f..eb94ed8b82 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -674,10 +674,10 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred)
if (!s->is_channel_coded[ich])
continue;
for (i = 0; i < order * num_channels; i++)
- pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] *
+ pred[ich] += (uint32_t)s->mclms_prevvalues[i + s->mclms_recent] *
s->mclms_coeffs[i + order * num_channels * ich];
for (i = 0; i < ich; i++)
- pred[ich] += s->channel_residues[i][icoef] *
+ pred[ich] += (uint32_t)s->channel_residues[i][icoef] *
s->mclms_coeffs_cur[i + num_channels * ich];
pred[ich] += 1 << s->mclms_scaling - 1;
pred[ich] >>= s->mclms_scaling;
@@ -822,7 +822,7 @@ static void revert_acfilter(WmallDecodeCtx *s, int tile_size)
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 += (uint32_t)s->channel_residues[ich][i - j - 1] * filter_coeffs[j];
pred >>= scaling;
s->channel_residues[ich][i] += pred;
}