File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
testing/integration/tests Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -809,7 +809,10 @@ where
809809 update_gas_available ( & mut store) ?;
810810
811811 let mut out = [ wasmtime:: Val :: I32 ( 0 ) ] ;
812- func. call ( & mut store, params. as_slice ( ) , & mut out) ?;
812+ let res = std:: panic:: catch_unwind ( std:: panic:: AssertUnwindSafe ( || {
813+ func. call ( & mut store, params. as_slice ( ) , & mut out)
814+ } ) )
815+ . map_err ( |panic| Abort :: Fatal ( anyhow ! ( "panic within actor: {:?}" , panic) ) ) ?;
813816
814817 // Charge for any remaining uncharged execution gas, returning an error if we run
815818 // out.
@@ -819,6 +822,10 @@ where
819822 // detected it and returned OutOfGas above. Any other invocation failure is returned
820823 // here as an Abort
821824
825+ if let Err ( err) = res {
826+ return Err ( err. into ( ) ) ;
827+ }
828+
822829 Ok ( out[ 0 ] . unwrap_i32 ( ) as u32 )
823830 } ) ( ) ;
824831
Original file line number Diff line number Diff line change @@ -589,14 +589,14 @@ fn test_exitcode(wat: &str, code: ExitCode) {
589589}
590590
591591#[ test]
592- fn infinite_loop ( ) {
592+ fn out_of_gas ( ) {
593593 test_exitcode (
594594 r#"(module
595595 (memory (export "memory") 1)
596596 (func (export "invoke") (param $x i32) (result i32)
597597 (loop (br 0))
598598 (i32.const 1)))"# ,
599- ExitCode :: SYS_ILLEGAL_INSTRUCTION ,
599+ ExitCode :: SYS_OUT_OF_GAS ,
600600 )
601601}
602602
You can’t perform that action at this time.
0 commit comments