Skip to content

Commit

Permalink
Limit fuzzer case input size to sensible sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Apr 9, 2024
1 parent e8ca8c5 commit ec869ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion fuzz/fuzz_targets/arbitrary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
6 changes: 4 additions & 2 deletions fuzz/fuzz_targets/from_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &str| {
if let Ok(value) = ron::from_str::<ron::Value>(data) {
let _ = ron::to_string(&value);
if data.len() < 50_000 {
if let Ok(value) = ron::from_str::<ron::Value>(data) {
let _ = ron::to_string(&value);
}
}
});

0 comments on commit ec869ef

Please sign in to comment.