summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author刘皓 <[email protected]>2025-04-20 14:48:02 -0400
committerYuta Saito <[email protected]>2025-04-27 15:47:30 +0900
commit45e814d1167d4e270621249bf2cc72676c54cf58 (patch)
tree809f288606091e20769657c609d89a5a9cadaf3d
parent687bd837244309fa293d6e08d0e13a662fce3a83 (diff)
Fix jump buffer leak in WASI builds
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13142
-rw-r--r--signal.c1
-rw-r--r--vm.c1
-rw-r--r--vm_trace.c1
3 files changed, 3 insertions, 0 deletions
diff --git a/signal.c b/signal.c
index 6f2fb1ddd3..6d711fc30d 100644
--- a/signal.c
+++ b/signal.c
@@ -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);
diff --git a/vm.c b/vm.c
index 884230c1d7..1ad3565a63 100644
--- a/vm.c
+++ b/vm.c
@@ -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);
}
diff --git a/vm_trace.c b/vm_trace.c
index 81fa6458b7..4032b1f639 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -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);