afl: gen -> parse, parse only

This commit is contained in:
Noah Hellman 2023-03-12 19:51:38 +01:00
parent 648a6dbef2
commit 2606e2f4fc
4 changed files with 12 additions and 16 deletions

View file

@ -53,7 +53,7 @@ bench:
cov: suite suite_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 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_JOBS?=1
AFL_TARGET_CRASH?=crashes AFL_TARGET_CRASH?=crashes

View file

@ -8,5 +8,5 @@ afl = "0.11"
jotdown = { path = "../../", features = ["deterministic"] } jotdown = { path = "../../", features = ["deterministic"] }
[[bin]] [[bin]]
name = "gen" name = "parse"
path = "src/gen.rs" path = "src/parse.rs"

View file

@ -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();
}
});
}

9
tests/afl/src/parse.rs Normal file
View file

@ -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();
}
});
}