File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -385,7 +385,11 @@ impl Lib {
385385
386386 let mut cursor = Cursor :: with ( & self . code , & self . data , & self . libs ) ;
387387 let lib_hash = self . id ( ) ;
388- cursor. seek ( entrypoint) . ok ( ) ?;
388+ if cursor. seek ( entrypoint) . is_err ( ) {
389+ registers. st0 = false ;
390+ #[ cfg( feature = "log" ) ]
391+ eprintln ! ( "jump to non-existing offset; halting, {d}st0{z} is set to {r}false{z}" ) ;
392+ }
389393
390394 #[ cfg( feature = "log" ) ]
391395 let mut st0 = registers. st0 ;
@@ -439,7 +443,7 @@ impl Lib {
439443 registers. st0 = false ;
440444 assert_eq ! ( registers. st0, false ) ;
441445 #[ cfg( feature = "log" ) ]
442- eprintln ! ( "execution stopped; {d}st0= {z}{r}{}{ z}" , registers . st0 ) ;
446+ eprintln ! ( "halting, {d}st0{z} is set to {r}false{ z}" ) ;
443447 return None ;
444448 }
445449 ExecStep :: Next => {
@@ -450,7 +454,13 @@ impl Lib {
450454 ExecStep :: Jump ( pos) => {
451455 #[ cfg( feature = "log" ) ]
452456 eprintln ! ( "{}" , pos) ;
453- cursor. seek ( pos) . ok ( ) ?;
457+ if cursor. seek ( pos) . is_err ( ) {
458+ registers. st0 = false ;
459+ #[ cfg( feature = "log" ) ]
460+ eprintln ! (
461+ "jump to non-existing offset; halting, {d}st0{z} is set to {r}false{z}"
462+ ) ;
463+ }
454464 }
455465 ExecStep :: Call ( site) => {
456466 #[ cfg( feature = "log" ) ]
You can’t perform that action at this time.
0 commit comments