Skip to content

Commit

Permalink
Merge #747
Browse files Browse the repository at this point in the history
747: [fix issue #724] replace panic! with return Err() r=syrusakbary a=pventuzelo

related to issue: #724

after the patch:
```
./target/release/wasmer run reported_issues/panic_wasm_trap_occured_call_indirect.wasm 
sizeof(UAFME) = 4
execute_wasm: "wasm trap occured: `call_indirect` out-of-bounds"
```

Co-authored-by: Patrick Ventuzelo <[email protected]>
Co-authored-by: Patrick Ventuzelo <[email protected]>
  • Loading branch information
3 people authored Sep 3, 2019
2 parents 777833e + 7dd496c commit 7e38e2b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bin/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,9 @@ fn execute_wasm(options: &Run) -> Result<(), String> {

if let Err(ref err) = result {
match err {
RuntimeError::Trap { msg } => panic!("wasm trap occured: {}", msg),
RuntimeError::Trap { msg } => {
return Err(format!("wasm trap occured: {}", msg))
}
#[cfg(feature = "wasi")]
RuntimeError::Error { data } => {
if let Some(error_code) = data.downcast_ref::<wasmer_wasi::ExitCode>() {
Expand All @@ -644,7 +646,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
#[cfg(not(feature = "wasi"))]
RuntimeError::Error { .. } => (),
}
panic!("error: {:?}", err)
return Err(format!("error: {:?}", err));
}
}
} else {
Expand Down

0 comments on commit 7e38e2b

Please sign in to comment.