Skip to content

Commit

Permalink
Merge branch 'master' into ventuzelo/fix-1057-substracte-overflow-peek1
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary authored Dec 12, 2019
2 parents aa13337 + 18318c2 commit b84aff7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## **[Unreleased]**

- [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend.
- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function.
- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI
- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI
- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box<Any + Send> instead of Box<Any>.
Expand Down
13 changes: 7 additions & 6 deletions src/bin/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ fn execute_wasi(
f.read_to_end(&mut out).unwrap();
Some(
wasmer_runtime_core::state::InstanceImage::from_bytes(&out)
.expect("failed to decode image"),
.map_err(|_| format!("failed to decode image"))?,
)
} else {
None
Expand Down Expand Up @@ -751,20 +751,21 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
args.push(Value::I32(x));
}

let index = instance
.resolve_func("_start")
.expect("The loader requires a _start function to be present in the module");
let index = instance.resolve_func("_start").map_err(|_| {
format!("The loader requires a _start function to be present in the module")
})?;

let mut ins: Box<dyn LoadedInstance<Error = String>> = match loader {
LoaderName::Local => Box::new(
instance
.load(LocalLoader)
.expect("Can't use the local loader"),
.map_err(|e| format!("Can't use the local loader: {:?}", e))?,
),
#[cfg(feature = "loader-kernel")]
LoaderName::Kernel => Box::new(
instance
.load(::wasmer_kernel_loader::KernelLoader)
.expect("Can't use the kernel loader"),
.map_err(|e| format!("Can't use the local loader: {:?}", e))?,
),
};
println!("{:?}", ins.call(index, &args));
Expand Down

0 comments on commit b84aff7

Please sign in to comment.