diff options
author | Alan Wu <[email protected]> | 2021-07-08 18:23:39 -0400 |
---|---|---|
committer | Alan Wu <[email protected]> | 2022-06-22 08:30:39 -0400 |
commit | 744d17ff6c33b09334508e8110007ea2a82252f5 (patch) | |
tree | 38579b596f6d2fea31a85864f75ce3d874968cbf /vm.c | |
parent | e6f92cada1cf8026d0dc6dbd11867ba9a994f4d6 (diff) |
Fix infinite loop when b_return TracePoint throws
Previously, we didn't pop the frame that runs the TracePoint hook for
b_return events for blocks running as methods (bmethods). In case the
hook raises, that formed an infinite loop during stack unwinding in
hook_before_rewind().
[Bug #18060]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4638
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2068,10 +2068,10 @@ hook_before_rewind(rb_execution_context_t *ec, const rb_control_frame_t *cfp, } - EXEC_EVENT_HOOK(ec, RUBY_EVENT_B_RETURN, ec->cfp->self, 0, 0, 0, bmethod_return_value); + EXEC_EVENT_HOOK_AND_POP_FRAME(ec, RUBY_EVENT_B_RETURN, ec->cfp->self, 0, 0, 0, bmethod_return_value); if (UNLIKELY(local_hooks && local_hooks->events & RUBY_EVENT_B_RETURN)) { rb_exec_event_hook_orig(ec, local_hooks, RUBY_EVENT_B_RETURN, - ec->cfp->self, 0, 0, 0, bmethod_return_value, FALSE); + ec->cfp->self, 0, 0, 0, bmethod_return_value, TRUE); } const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(ec->cfp); |