]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/iff: Check length before memcpy() in decode_deep_rle32()
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 20 Apr 2020 22:03:40 +0000 (00:03 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 22 Apr 2020 20:57:38 +0000 (22:57 +0200)
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@niedermayer.cc>
libavcodec/iff.c

index 2e65e266d0fd974b43a35999c4dcf5ce58f52821..75be844a952f5a9b04a0c51b2e0f723de5b49623 100644 (file)
@@ -722,6 +722,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;