diff --git a/tools/target_dem_fuzzer.c b/tools/target_dem_fuzzer.c index 8c9e373367..6f4f062f13 100644 --- a/tools/target_dem_fuzzer.c +++ b/tools/target_dem_fuzzer.c @@ -86,6 +86,7 @@ static int64_t io_seek(void *opaque, int64_t offset, int whence) // Ensure we don't loop forever const uint32_t maxiteration = 8096; +const int maxblocks= 100000; static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL; @@ -158,6 +159,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { av_strlcatf(filename, sizeof(filename), ".%s", extension); } } + + if (!io_buffer_size || size / io_buffer_size > maxblocks) + io_buffer_size = size; + io_buffer = av_malloc(io_buffer_size); if (!io_buffer) error("Failed to allocate io_buffer");