File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -385,7 +385,12 @@ 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+ return None ;
393+ }
389394
390395 #[ cfg( feature = "log" ) ]
391396 let mut st0 = registers. st0 ;
@@ -439,7 +444,7 @@ impl Lib {
439444 registers. st0 = false ;
440445 assert_eq ! ( registers. st0, false ) ;
441446 #[ cfg( feature = "log" ) ]
442- eprintln ! ( "execution stopped; {d}st0= {z}{r}{}{ z}" , registers . st0 ) ;
447+ eprintln ! ( "halting, {d}st0{z} is set to {r}false{ z}" ) ;
443448 return None ;
444449 }
445450 ExecStep :: Next => {
@@ -450,7 +455,14 @@ impl Lib {
450455 ExecStep :: Jump ( pos) => {
451456 #[ cfg( feature = "log" ) ]
452457 eprintln ! ( "{}" , pos) ;
453- cursor. seek ( pos) . ok ( ) ?;
458+ if cursor. seek ( pos) . is_err ( ) {
459+ registers. st0 = false ;
460+ #[ cfg( feature = "log" ) ]
461+ eprintln ! (
462+ "jump to non-existing offset; halting, {d}st0{z} is set to {r}false{z}"
463+ ) ;
464+ return None ;
465+ }
454466 }
455467 ExecStep :: Call ( site) => {
456468 #[ cfg( feature = "log" ) ]
You can’t perform that action at this time.
0 commit comments