Skip to content

Commit 45e814d

Browse files
white-axekateinoigakukun
authored andcommitted
Fix jump buffer leak in WASI builds
1 parent 687bd83 commit 45e814d

3 files changed

Lines changed: 3 additions & 0 deletions

File tree

signal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ check_stack_overflow(int sig, const uintptr_t addr, const ucontext_t *ctx)
853853
* otherwise it can cause stack overflow again at the same
854854
* place. */
855855
if ((crit = (!ec->tag->prev || !--uplevel)) != FALSE) break;
856+
rb_vm_tag_jmpbuf_deinit(&ec->tag->buf);
856857
ec->tag = ec->tag->prev;
857858
}
858859
reset_sigmask(sig);

vm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2852,6 +2852,7 @@ vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, V
28522852
if (VM_FRAME_FINISHED_P(ec->cfp)) {
28532853
rb_vm_pop_frame(ec);
28542854
ec->errinfo = (VALUE)err;
2855+
rb_vm_tag_jmpbuf_deinit(&ec->tag->buf);
28552856
ec->tag = ec->tag->prev;
28562857
EC_JUMP_TAG(ec, state);
28572858
}

vm_trace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ rb_exec_event_hooks(rb_trace_arg_t *trace_arg, rb_hook_list_t *hooks, int pop_p)
453453
if (state) {
454454
if (pop_p) {
455455
if (VM_FRAME_FINISHED_P(ec->cfp)) {
456+
rb_vm_tag_jmpbuf_deinit(&ec->tag->buf);
456457
ec->tag = ec->tag->prev;
457458
}
458459
rb_vm_pop_frame(ec);

0 commit comments

Comments
 (0)