From fa7564692ecae9ca134ed436dd533e989674868b Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Sat, 24 Feb 2018 11:31:52 +0000 Subject: [PATCH] Add honggfuzz. --- hfuzz/.gitignore | 2 ++ hfuzz/Cargo.toml | 9 +++++++++ hfuzz/src/lib.rs | 7 +++++++ hfuzz/src/main.rs | 21 +++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 hfuzz/.gitignore create mode 100644 hfuzz/Cargo.toml create mode 100644 hfuzz/src/lib.rs create mode 100644 hfuzz/src/main.rs diff --git a/hfuzz/.gitignore b/hfuzz/.gitignore new file mode 100644 index 0000000..e2e686c --- /dev/null +++ b/hfuzz/.gitignore @@ -0,0 +1,2 @@ +hfuzz_workspace/ +hfuzz_target/ diff --git a/hfuzz/Cargo.toml b/hfuzz/Cargo.toml new file mode 100644 index 0000000..d79e9bd --- /dev/null +++ b/hfuzz/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "hfuzz" +version = "0.1.0" +authors = ["Sergey Pepyakin "] + +[dependencies] +honggfuzz = "0.5" +wasmi = { path = ".." } + diff --git a/hfuzz/src/lib.rs b/hfuzz/src/lib.rs new file mode 100644 index 0000000..31e1bb2 --- /dev/null +++ b/hfuzz/src/lib.rs @@ -0,0 +1,7 @@ +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} diff --git a/hfuzz/src/main.rs b/hfuzz/src/main.rs new file mode 100644 index 0000000..da4d3f6 --- /dev/null +++ b/hfuzz/src/main.rs @@ -0,0 +1,21 @@ +#[macro_use] extern crate honggfuzz; + +fn main() { + // Here you can parse `std::env::args and + // setup / initialize your project + + // You have full control over the loop but + // you're supposed to call `fuzz` ad vitam aeternam + loop { + // The fuzz macro gives an arbitrary object (see `arbitrary crate`) + // to a closure-like block of code. + // For performance reasons, it is recommended that you use the native type + // `&[u8]` when possible. + // Here, this slice will contain a "random" quantity of "random" data. + fuzz!(|data: &[u8]| { + }); + } + + +} +