Skip to content

Commit

Permalink
better fuzz.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
joonazan committed May 26, 2024
1 parent d3009b8 commit 26beac1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
6 changes: 5 additions & 1 deletion afl-fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ features = ["single_instruction_test"]

[[bin]]
name = "show_testcase"
path = "src/show_testcase.rs"
path = "src/show_testcase.rs"

[[bin]]
name = "check_input_size"
path = "src/check_input_size.rs"
3 changes: 2 additions & 1 deletion afl-fuzz/fuzz.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
cargo afl build --release && cargo afl fuzz -i in -o out ../target/release/afl-fuzz -g 10k
export AFL_AUTORESUME=1
cargo afl build --release && cargo afl fuzz -i in -o out -g $(cargo run --bin check_input_size) ../target/release/afl-fuzz
17 changes: 17 additions & 0 deletions afl-fuzz/src/check_input_size.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! Finds out how many bytes of data have to be provided to build the mock state.
use arbitrary::Arbitrary;
use vm2::{MockWorld, VirtualMachine};

fn main() {
let data = [2; 10000];
let mut u = arbitrary::Unstructured::new(&data);
let _: VmAndWorld = u.arbitrary().unwrap();
println!("{:?}", u.len());
}

#[derive(Arbitrary, Debug)]
struct VmAndWorld {
_vm: VirtualMachine,
_world: MockWorld,
}

0 comments on commit 26beac1

Please sign in to comment.