summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-23 18:54:51 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-10-24 22:38:55 +0200
commit6e64d89410c1833a240f4ff3ea47e8786ea49b79 (patch)
tree3ff6ca17c183148f317e040783384e1a4eab3528 /tools
parentb990148d1e6dcfed7fc0a5d2d0d7f636fcf9896b (diff)
downloadffmpeg-6e64d89410c1833a240f4ff3ea47e8786ea49b79.tar.gz
tools/target_dem_fuzzer: Limit max blocks
With a IO block size of 1 byte potentially megabytes are quite slow to read, thus limit the number Fixes: 26511/clusterfuzz-testcase-minimized-ffmpeg_dem_NUV_fuzzer-5679249073373184 Fixes: 26517/clusterfuzz-testcase-minimized-ffmpeg_dem_XMV_fuzzer-6316634501021696 Fixes: 26518/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-485568285324083 Fixes: 26525/clusterfuzz-testcase-minimized-ffmpeg_dem_MSNWC_TCP_fuzzer-5121987011411968 Fixes: 26538/clusterfuzz-testcase-minimized-ffmpeg_dem_DHAV_fuzzer-5441800598454272 Fixes: OOM Fixes: Timeout Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'tools')
-rw-r--r--tools/target_dem_fuzzer.c5
1 files changed, 5 insertions, 0 deletions
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");