[FFmpeg-cvslog] avcodec/wmalosslessdec: Fix loop in revert_acfilter()

Michael Niedermayer git at videolan.org
Fri Apr 24 02:13:45 EEST 2020


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Sat Jan 18 19:28:36 2020 +0100| [661446f9d678d5212c7c10326b37f2f7ac7a371d] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit 5584c0bb945d6010a9d8c22ef3270792022e1761)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=661446f9d678d5212c7c10326b37f2f7ac7a371d
---

 libavcodec/wmalosslessdec.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index e7c8266cf2..9888ea43d6 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -817,8 +817,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];
     }
 }
 



More information about the ffmpeg-cvslog mailing list