From dae2842fa2c7662c28165811062c2a2356224f3a Mon Sep 17 00:00:00 2001 From: davkor Date: Wed, 13 May 2020 20:56:19 +0100 Subject: [PATCH] Added initial fuzzing setup. --- fuzz/.gitignore | 4 ++++ fuzz/Cargo.toml | 24 ++++++++++++++++++++++++ fuzz/fuzz_targets/fuzz_from_slice.rs | 6 ++++++ 3 files changed, 34 insertions(+) create mode 100644 fuzz/.gitignore create mode 100644 fuzz/Cargo.toml create mode 100644 fuzz/fuzz_targets/fuzz_from_slice.rs diff --git a/fuzz/.gitignore b/fuzz/.gitignore new file mode 100644 index 00000000..572e03bd --- /dev/null +++ b/fuzz/.gitignore @@ -0,0 +1,4 @@ + +target +corpus +artifacts diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml new file mode 100644 index 00000000..a4dabcc6 --- /dev/null +++ b/fuzz/Cargo.toml @@ -0,0 +1,24 @@ + +[package] +name = "serde_yaml-fuzz" +version = "0.0.0" +authors = ["David Korczynski "] +publish = false +edition = "2018" + +[package.metadata] +cargo-fuzz = true + +[dependencies] +libfuzzer-sys = "0.3" + +[dependencies.serde_yaml] +path = ".." + +# Prevent this from interfering with workspaces +[workspace] +members = ["."] + +[[bin]] +name = "fuzz_from_slice" +path = "fuzz_targets/fuzz_from_slice.rs" diff --git a/fuzz/fuzz_targets/fuzz_from_slice.rs b/fuzz/fuzz_targets/fuzz_from_slice.rs new file mode 100644 index 00000000..e0e9b110 --- /dev/null +++ b/fuzz/fuzz_targets/fuzz_from_slice.rs @@ -0,0 +1,6 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = serde_yaml::from_slice::(data); +});