Fix jump buffer leak in WASI builds

This commit is contained in:
刘皓 2025-04-20 14:48:02 -04:00 committed by Yuta Saito
parent 687bd83724
commit 45e814d116
Notes: git 2025-04-27 06:47:46 +00:00
3 changed files with 3 additions and 0 deletions

View File

@ -853,6 +853,7 @@ check_stack_overflow(int sig, const uintptr_t addr, const ucontext_t *ctx)
* otherwise it can cause stack overflow again at the same
* place. */
if ((crit = (!ec->tag->prev || !--uplevel)) != FALSE) break;
rb_vm_tag_jmpbuf_deinit(&ec->tag->buf);
ec->tag = ec->tag->prev;
}
reset_sigmask(sig);

1
vm.c
View File

@ -2852,6 +2852,7 @@ vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, V
if (VM_FRAME_FINISHED_P(ec->cfp)) {
rb_vm_pop_frame(ec);
ec->errinfo = (VALUE)err;
rb_vm_tag_jmpbuf_deinit(&ec->tag->buf);
ec->tag = ec->tag->prev;
EC_JUMP_TAG(ec, state);
}

View File

@ -453,6 +453,7 @@ rb_exec_event_hooks(rb_trace_arg_t *trace_arg, rb_hook_list_t *hooks, int pop_p)
if (state) {
if (pop_p) {
if (VM_FRAME_FINISHED_P(ec->cfp)) {
rb_vm_tag_jmpbuf_deinit(&ec->tag->buf);
ec->tag = ec->tag->prev;
}
rb_vm_pop_frame(ec);