mirror of https://github.com/status-im/evmc.git
Merge pull request #316 from ethereum/rust-panic
rust: unwind execution panics in evmc-declare
This commit is contained in:
commit
9b2de67eda
|
@ -363,7 +363,15 @@ fn build_execute_fn(names: &VMNameSet) -> proc_macro2::TokenStream {
|
|||
::evmc_vm::EvmcContainer::<#type_name_ident>::from_ffi_pointer(instance)
|
||||
};
|
||||
|
||||
let result = container.execute(code_ref, &execution_context);
|
||||
let result = ::std::panic::catch_unwind(|| {
|
||||
container.execute(code_ref, &execution_context)
|
||||
});
|
||||
|
||||
let result = if result.is_err() {
|
||||
::evmc_vm::ExecutionResult::new(::evmc_vm::ffi::evmc_status_code::EVMC_INTERNAL_ERROR, 0, None)
|
||||
} else {
|
||||
result.unwrap()
|
||||
};
|
||||
|
||||
unsafe {
|
||||
::evmc_vm::EvmcContainer::into_ffi_pointer(container);
|
||||
|
|
Loading…
Reference in New Issue