From 555309a480f0f211a49da6429acc41aa37bad08d Mon Sep 17 00:00:00 2001 From: Afonso Bordado Date: Mon, 12 Sep 2022 17:10:49 +0100 Subject: [PATCH] fuzzgen: Continue execution on traps (#4895) --- fuzz/fuzz_targets/cranelift-fuzzgen.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fuzz/fuzz_targets/cranelift-fuzzgen.rs b/fuzz/fuzz_targets/cranelift-fuzzgen.rs index 859007c3a3..c0d2a2418b 100644 --- a/fuzz/fuzz_targets/cranelift-fuzzgen.rs +++ b/fuzz/fuzz_targets/cranelift-fuzzgen.rs @@ -104,15 +104,18 @@ fuzz_target!(|testcase: TestCase| { match int_res { RunResult::Success(_) => {} RunResult::Trap(_) => { - // We currently ignore inputs that trap the interpreter + // If this input traps, skip it and continue trying other inputs + // for this function. We've already compiled it anyway. + // // We could catch traps in the host run and compare them to the // interpreter traps, but since we already test trap cases with // wasm tests and wasm-level fuzzing, the amount of effort does // not justify implementing it again here. - return; + continue; } RunResult::Timeout => { - // We probably generated an infinite loop, we can ignore this + // We probably generated an infinite loop, we should drop this entire input. + // We could `continue` like we do on traps, but timeouts are *really* expensive. return; } RunResult::Error(_) => panic!("interpreter failed: {:?}", int_res),