Skip to content

Commit

Permalink
Fix longjmp being invoked with a 0 arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Arshia001 committed Mar 18, 2024
1 parent 5fbfe54 commit e61b03c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libc-bottom-half/sources/__wasilibc_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,8 @@ int __wasilibc_setjmp(__wasi_stack_snapshot_t * buf) {
}

_Noreturn void __wasilibc_longjmp(__wasi_stack_snapshot_t * buf, int val) {
if (val == 0) {
val = 1;
}
__wasi_stack_restore(buf, (uint64_t)val);
}

0 comments on commit e61b03c

Please sign in to comment.