pub fn execute<'a, T, U>(
input: &'a [u8],
run: fn(&[u8], KnownValid, T, &mut Unstructured<'a>) -> Result<U>,
gen_module: fn(&mut T, &mut Unstructured<'a>) -> Result<(Vec<u8>, KnownValid)>,
) -> Result<U>where
T: Arbitrary<'a>,
Expand description
Executes a “single module fuzzer” given the raw input
from libfuzzer.
This will use the input
to generate T
, some configuration, which is
then used by gen_module
to generate a WebAssembly module. The module is
then passed to run
along with the configuration and remaining data that
can be used as fuzz input.
The main purpose of this function is to handle when input
is actually a
WebAssembly module “envelope”. If the input
is a valid wasm module and
ends with a specific trailing custom section then the module generated by
gen_module
is actually discarded. The purpose of this is to handle the
case where the input used to generate a module may change over time but
we’re still interested in the historical coverage of the original wasm
module.