From ec869ef5af434eea25fff3df70b378fc1f23f705 Mon Sep 17 00:00:00 2001 From: Juniper Tyree <50025784+juntyr@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:56:13 +0000 Subject: [PATCH] Limit fuzzer case input size to sensible sizes --- fuzz/fuzz_targets/arbitrary.rs | 4 +++- fuzz/fuzz_targets/from_str.rs | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fuzz/fuzz_targets/arbitrary.rs b/fuzz/fuzz_targets/arbitrary.rs index 2ef87fb2d..c4add10dc 100644 --- a/fuzz/fuzz_targets/arbitrary.rs +++ b/fuzz/fuzz_targets/arbitrary.rs @@ -22,5 +22,7 @@ use libfuzzer_sys::fuzz_target; mod typed_data; fuzz_target!(|data: &[u8]| { - typed_data::roundtrip_arbitrary_typed_ron_or_panic(data); + if data.len() < 50_000 { + typed_data::roundtrip_arbitrary_typed_ron_or_panic(data); + } }); diff --git a/fuzz/fuzz_targets/from_str.rs b/fuzz/fuzz_targets/from_str.rs index 8aaa89962..1d537fedb 100644 --- a/fuzz/fuzz_targets/from_str.rs +++ b/fuzz/fuzz_targets/from_str.rs @@ -16,7 +16,9 @@ use libfuzzer_sys::fuzz_target; fuzz_target!(|data: &str| { - if let Ok(value) = ron::from_str::(data) { - let _ = ron::to_string(&value); + if data.len() < 50_000 { + if let Ok(value) = ron::from_str::(data) { + let _ = ron::to_string(&value); + } } });