diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-04-21 00:03:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-05-19 17:17:36 +0200 |
commit | 4d9462837c1d193ae325b065594bcc543761eb35 (patch) | |
tree | caa7a8267e9cf6459b2a52a7c01a6e8258918e79 | |
parent | 22fba2adee0b2fd0cf88a47a1c89535a54abd1b9 (diff) | |
download | ffmpeg-4d9462837c1d193ae325b065594bcc543761eb35.tar.gz |
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@niedermayer.cc>
(cherry picked from commit b4a33387cb1cd3f4c5036e65e0fdd953c6b5012f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/iff.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c index ffd2c6e928..a38de9979e 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -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; |