WasmFuzz/src/lib.rs

46 lines
1.0 KiB
Rust

use wasmi::{ModuleInstance, ImportsBuilder, NopExternals, RuntimeValue};
fn init_population() -> Vec<u8> {
unimplemented!();
}
fn mutate() -> Vec<u8> {
unimplemented!();
}
fn parse_expr(expr: Vec<u8>) -> Vec<u8> {
unimplemented!();
}
fn asd() {
let wasm_binary: Vec<u8> =
wabt::wat2wasm(
r#"
(module
(func (export "test") (param i32) (result i32)
i32.const 1337
)
)
"#,
)
.expect("failed to parse wat");
let module = parity_wasm::elements::Module::from_bytes(&wasm_binary)
.expect("failed to load wasm");
for (export, function) in module.export_section().unwrap().entries().iter()
.zip(module.function_section().unwrap().entries().iter()) {
let func_body: parity_wasm::elements::FuncBody =
function.try_into().unwrap();
println!("{} - {:?}", export.field(), function);
}
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
super::asd();
}
}