From 65bb38dfc48377c6c55038af5cffb3ac804dbff6 Mon Sep 17 00:00:00 2001 From: enjhnsn2 Date: Wed, 25 Aug 2021 16:57:00 -0500 Subject: [PATCH] Fix veriwasm fuzzing script To the best of my knowledge, the current veriwasm fuzzing script will not actually report an error when veriwasm fails to verify the compiled code. This is because the fuzz_target! harness will only catch panics, and the script does not panic on error. This change will make the script panic on verification failure. I'm not super familiar with using libfuzzer in rust, so if this is a mistake let me know. --- fuzz/fuzz_targets/veriwasm.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fuzz/fuzz_targets/veriwasm.rs b/fuzz/fuzz_targets/veriwasm.rs index f1c91cd8..3136b13e 100644 --- a/fuzz/fuzz_targets/veriwasm.rs +++ b/fuzz/fuzz_targets/veriwasm.rs @@ -77,7 +77,9 @@ fn run_test(bytes: &[u8]) -> Result<(), Error> { return Ok(()); } - build(/* with_veriwasm = */ true, bytes, &tempdir, "veriwasm")?; + if build(/* with_veriwasm = */ true, bytes, &tempdir, "veriwasm").is_err(){ + panic!("Veriwasm returned an error!"); + } Ok(()) }