MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / run_one

Function run_one

fuzz/fuzz_targets/call_async.rs:13–39  ·  view source on GitHub ↗
(data: &[u8])

Source from the content-addressed store, hash-verified

11});
12
13fn run_one(data: &[u8]) -> Result<()> {
14 let mut u = Unstructured::new(data);
15 let mut config: generators::Config = u.arbitrary()?;
16
17 // Try to ensure imports/exports/etc are generated by adding one to the
18 // minimums/maximums.
19 config.module_config.config.min_types = 1;
20 config.module_config.config.max_types += 1;
21 config.module_config.config.min_imports = 1;
22 config.module_config.config.max_imports += 1;
23 config.module_config.config.min_funcs = 1;
24 config.module_config.config.max_funcs += 1;
25 config.module_config.config.min_exports = 1;
26 config.module_config.config.max_exports += 1;
27
28 // Use the fuzz input to select an async strategy.
29 config.enable_async(&mut u)?;
30
31 let mut poll_amts = Vec::with_capacity(u.arbitrary_len::<u32>()?);
32 for _ in 0..poll_amts.capacity() {
33 poll_amts.push(u.int_in_range(0..=10_000)?);
34 }
35 let module = config.module_config.generate(&mut u, None)?;
36 oracles::call_async(&module.to_bytes(), &config, &poll_amts);
37
38 Ok(())
39}

Callers

nothing calls this directly

Calls 9

call_asyncFunction · 0.85
OkFunction · 0.85
enable_asyncMethod · 0.80
newFunction · 0.50
arbitraryMethod · 0.45
capacityMethod · 0.45
pushMethod · 0.45
generateMethod · 0.45
to_bytesMethod · 0.45

Tested by

no test coverage detected