diff mbox series

[FFmpeg-devel,1/5] avcodec/iff: Fix off by x error

Message ID 20200613112345.13515-1-michael@niedermayer.cc
State Accepted
Commit 51225dee0a6266780d26d43bd6802bbcf736327e
Headers show
Series [FFmpeg-devel,1/5] avcodec/iff: Fix off by x error
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer June 13, 2020, 11:23 a.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer June 14, 2020, 4:38 p.m. UTC | #1
On Sat, Jun 13, 2020 at 01:23:41PM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 23245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5723121327013888.fuzz

will apply patchset with requested modifications


[...]
diff mbox series

Patch

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 66879cbf5d..79f6215c77 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -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);