Change translate_module to use a slice rather than a borrowed Vec.
This makes it more convenient to call from a cargo-fuzz fuzzer.
This commit is contained in:
@@ -58,10 +58,10 @@ impl ImportMappings {
|
|||||||
/// [`Function`](../cretonne/ir/function/struct.Function.html).
|
/// [`Function`](../cretonne/ir/function/struct.Function.html).
|
||||||
/// Returns the functions and also the mappings for imported functions and signature between the
|
/// Returns the functions and also the mappings for imported functions and signature between the
|
||||||
/// indexes in the wasm module and the indexes inside each functions.
|
/// indexes in the wasm module and the indexes inside each functions.
|
||||||
pub fn translate_module(data: &Vec<u8>,
|
pub fn translate_module(data: &[u8],
|
||||||
runtime: &mut WasmRuntime)
|
runtime: &mut WasmRuntime)
|
||||||
-> Result<TranslationResult, String> {
|
-> Result<TranslationResult, String> {
|
||||||
let mut parser = Parser::new(data.as_slice());
|
let mut parser = Parser::new(data);
|
||||||
match *parser.read() {
|
match *parser.read() {
|
||||||
ParserState::BeginWasm { .. } => {}
|
ParserState::BeginWasm { .. } => {}
|
||||||
ParserState::Error(BinaryReaderError { message, offset }) => {
|
ParserState::Error(BinaryReaderError { message, offset }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user