Wasynth/fuzz/fuzz_targets/full_transpile.rs
2021-12-31 15:30:34 -05:00

20 lines
460 B
Rust

#![no_main]
use wasm_smith::Module;
use wasm::writer::{base::Transpiler, luajit::LuaJIT};
// We are not interested in parity_wasm errors.
// Only 1 edition should need to be tested too.
libfuzzer_sys::fuzz_target!(|module: Module| {
let data = module.to_bytes();
let wasm = match parity_wasm::deserialize_buffer(&data) {
Ok(v) => v,
Err(_) => return,
};
LuaJIT::new(&wasm)
.transpile(&mut std::io::sink())
.expect("LuaJIT should succeed");
});