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

Function validate

crates/fuzzing/src/generators/gc_access.rs:1651–1662  ·  view source on GitHub ↗
(wasm: &[u8])

Source from the content-addressed store, hash-verified

1649 }
1650
1651 fn validate(wasm: &[u8]) {
1652 let mut validator = Validator::new_with_features(wasmparser::WasmFeatures::all());
1653 let err = match validator.validate_all(wasm) {
1654 Ok(_) => return,
1655 Err(e) => e,
1656 };
1657 drop(std::fs::write("test.wasm", wasm));
1658 if let Ok(text) = wasmprinter::print_bytes(wasm) {
1659 drop(std::fs::write("test.wat", &text));
1660 }
1661 panic!("wasm failed to validate: {err}");
1662 }
1663}

Callers 1

Calls 3

print_bytesFunction · 0.85
dropFunction · 0.50
writeFunction · 0.50

Tested by 1