]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/iff: Fix off by x error
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 13 Jun 2020 08:48:14 +0000 (10:48 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 Jun 2020 16:20:37 +0000 (18:20 +0200)
Fixes: out of array access
Fixes: 23245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5723121327013888.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 66879cbf5dde06f132e06ff803028324e9d84a79..79f6215c7700bef2008cc4c06680024b1b997ddd 100644 (file)
@@ -723,7 +723,7 @@ static void decode_deep_rle32(uint8_t *dst, const uint8_t *src, int src_size, in
         if (opcode >= 0) {
             int size = opcode + 1;
             for (i = 0; i < size; i++) {
-                int length = FFMIN(size - i, width);
+                int length = FFMIN(size - i, width - x);
                 if (src_end - src < length * 4)
                     return;
                 memcpy(dst + y*linesize + x * 4, src, length * 4);