aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-01-18 19:28:36 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commit44da920eb70a5a56c5ad9a0becd33b97cf1e856c (patch)
tree0cc5c0350a6ba1f9524fa353846e6b78bbbbd116 /libavcodec
parente1aa37ce1a3659ad33f88de8b68c5b6e27f20fb7 (diff)
downloadffmpeg-44da920eb70a5a56c5ad9a0becd33b97cf1e856c.tar.gz
avcodec/wmalosslessdec: Fix loop in revert_acfilter()
Fixes: out of array read Fixes: 20059/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5691776237305856 No testcase except the fuzzed one. 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 5584c0bb945d6010a9d8c22ef3270792022e1761) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/wmalosslessdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index e4cc914571..ea5a333860 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -827,8 +827,11 @@ static void revert_acfilter(WmallDecodeCtx *s, int tile_size)
pred >>= scaling;
s->channel_residues[ich][i] += (unsigned)pred;
}
- for (j = 0; j < order; j++)
- prevvalues[j] = s->channel_residues[ich][tile_size - j - 1];
+ for (j = order - 1; j >= 0; j--)
+ if (tile_size <= j) {
+ prevvalues[j] = prevvalues[j - tile_size];
+ }else
+ prevvalues[j] = s->channel_residues[ich][tile_size - j - 1];
}
}