aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-11-18 09:45:29 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 15:03:15 +0100
commite6f31fa16c0aa9c99a185bd683d2edce26e2bdcb (patch)
tree5cdc9372bd8d20db9be93e25c43d9b88218b3522
parent4b521929cf739127b544d02bbcf45c1598cc085e (diff)
downloadffmpeg-e6f31fa16c0aa9c99a185bd683d2edce26e2bdcb.tar.gz
avcodec/iff: Skip overflowing runs in decode_delta_d()
Fixes: Timeout (107sec - 75ms> Fixes: 18812/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6295585225441280 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 185f441ba26a2112725db1e8f218e54ac8068bbb) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/iff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 8a2ae2542d..eac873c9da 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -1359,6 +1359,8 @@ static void decode_delta_d(uint8_t *dst,
bytestream2_seek_p(&pb, (offset / planepitch_byte) * pitch + (offset % planepitch_byte) + k * planepitch, SEEK_SET);
if (opcode >= 0) {
uint32_t x = bytestream2_get_be32(&gb);
+ if (opcode && 4 + (opcode - 1LL) * pitch > bytestream2_get_bytes_left_p(&pb))
+ continue;
while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {
bytestream2_put_be32(&pb, x);
bytestream2_skip_p(&pb, pitch - 4);