[FFmpeg-cvslog] avcodec/iff: Check length before memcpy() in decode_deep_rle32()

Michael Niedermayer git at videolan.org
Fri Apr 24 02:14:51 EEST 2020


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Tue Apr 21 00:03:40 2020 +0200| [56774297bb5a49421d3e4d60d62371cc5a68b26a] | committer: Michael Niedermayer

avcodec/iff: Check length before memcpy() in decode_deep_rle32()

Fixes: out of array read
Fixes: 20796/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5111364702175232.fuzz

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 b4a33387cb1cd3f4c5036e65e0fdd953c6b5012f)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/iff.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 7f8f868ba9..3fe27f25ab 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -597,6 +597,8 @@ static void decode_deep_rle32(uint8_t *dst, const uint8_t *src, int src_size, in
             int size = opcode + 1;
             for (i = 0; i < size; i++) {
                 int length = FFMIN(size - i, width);
+                if (src_end - src < length * 4)
+                    return;
                 memcpy(dst + y*linesize + x * 4, src, length * 4);
                 src += length * 4;
                 x += length;



More information about the ffmpeg-cvslog mailing list