summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-07-10 14:38:00 -0700
committerJeremy Evans <code@jeremyevans.net>2020-07-27 08:18:11 -0700
commiteeef16e190cdabc2ba474622720f8e3df7bac43b (patch)
tree9d238fbd2ee801743f4c1f31c7f162ddba84bb23 /vm_insnhelper.c
parentcb5127927a2b6ac4fa143dff44d4d896ed4a6372 (diff)
Prevent SystemStackError when calling super in module with activated refinement
Without this, if a refinement defines a method that calls super and includes a module with a module that calls super and has a activated refinement at the point super is called, the module method super call will end up calling back into the refinement method, creating a loop. Fixes [Bug #17007]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3309
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index b69fd55259..e6228fb466 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -3034,6 +3034,9 @@ search_refined_method(rb_execution_context_t *ec, rb_control_frame_t *cfp, struc
if (ref_me) {
if (vm_cc_call(cc) == vm_call_super_method) {
const rb_control_frame_t *top_cfp = current_method_entry(ec, cfp);
+ if (refinement == find_refinement(CREF_REFINEMENTS(vm_get_cref(top_cfp->ep)), vm_cc_cme(cc)->owner)) {
+ continue;
+ }
const rb_callable_method_entry_t *top_me = rb_vm_frame_method_entry(top_cfp);
if (top_me && rb_method_definition_eq(ref_me->def, top_me->def)) {
continue;