aboutsummaryrefslogtreecommitdiffstats
path: root/tools/target_swr_fuzzer.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-09-22 20:15:40 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-09-24 15:37:18 +0200
commit6190e826471fd9d3a66685000b5b3e4d8b163013 (patch)
tree01a5ee58cfce20661af81955b738a789f3c2d45c /tools/target_swr_fuzzer.c
parent5ded752241aec7d21b539c4c8606569e4fe3a164 (diff)
downloadffmpeg-6190e826471fd9d3a66685000b5b3e4d8b163013.tar.gz
tools/target_swr_fuzzer: Limit the number of samples
Fixes: OOM and Timeout Fixes: 71254/clusterfuzz-testcase-minimized-ffmpeg_SWR_fuzzer-5941896977907712 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/target_swr_fuzzer.c')
-rw-r--r--tools/target_swr_fuzzer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/target_swr_fuzzer.c b/tools/target_swr_fuzzer.c
index b6cdb72a56..9192d4bed5 100644
--- a/tools/target_swr_fuzzer.c
+++ b/tools/target_swr_fuzzer.c
@@ -129,6 +129,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
in_sample_nb = size / (in_ch_count * av_get_bytes_per_sample(in_sample_fmt));
out_sample_nb = out_sample_nb % (av_rescale(in_sample_nb, 2*out_sample_rate, in_sample_rate) + 1);
+ if (in_sample_nb > 1000*1000 || out_sample_nb > 1000*1000)
+ goto end;
+
out_data = av_malloc(out_sample_nb * out_ch_count * av_get_bytes_per_sample(out_sample_fmt));
if (!out_data)
goto end;