From 2606e2f4fcf7fffa302dd0b60df350ecfd01e3d1 Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Sun, 12 Mar 2023 19:51:38 +0100 Subject: [PATCH] afl: gen -> parse, parse only --- Makefile | 2 +- tests/afl/Cargo.toml | 4 ++-- tests/afl/src/gen.rs | 13 ------------- tests/afl/src/parse.rs | 9 +++++++++ 4 files changed, 12 insertions(+), 16 deletions(-) delete mode 100644 tests/afl/src/gen.rs create mode 100644 tests/afl/src/parse.rs diff --git a/Makefile b/Makefile index 9a9c45f..cc67ad8 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ bench: cov: suite suite_bench LLVM_COV=llvm-cov LLVM_PROFDATA=llvm-profdata cargo llvm-cov --features=suite,suite_bench --workspace --html --ignore-run-fail -AFL_TARGET?=gen +AFL_TARGET?=parse AFL_JOBS?=1 AFL_TARGET_CRASH?=crashes diff --git a/tests/afl/Cargo.toml b/tests/afl/Cargo.toml index adf9924..52e6595 100644 --- a/tests/afl/Cargo.toml +++ b/tests/afl/Cargo.toml @@ -8,5 +8,5 @@ afl = "0.11" jotdown = { path = "../../", features = ["deterministic"] } [[bin]] -name = "gen" -path = "src/gen.rs" +name = "parse" +path = "src/parse.rs" diff --git a/tests/afl/src/gen.rs b/tests/afl/src/gen.rs deleted file mode 100644 index 6bd2664..0000000 --- a/tests/afl/src/gen.rs +++ /dev/null @@ -1,13 +0,0 @@ -use afl::fuzz; - -use jotdown::Render; - -fn main() { - fuzz!(|data: &[u8]| { - if let Ok(s) = std::str::from_utf8(data) { - let p = jotdown::Parser::new(s); - let mut output = String::new(); - jotdown::html::Renderer.push(p, &mut output).unwrap(); - } - }); -} diff --git a/tests/afl/src/parse.rs b/tests/afl/src/parse.rs new file mode 100644 index 0000000..8262eb9 --- /dev/null +++ b/tests/afl/src/parse.rs @@ -0,0 +1,9 @@ +use afl::fuzz; + +fn main() { + fuzz!(|data: &[u8]| { + if let Ok(s) = std::str::from_utf8(data) { + jotdown::Parser::new(s).last().unwrap(); + } + }); +}