diff options
author | nagachika <nagachika@ruby-lang.org> | 2020-08-01 17:33:56 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2020-08-01 17:33:56 +0900 |
commit | 23d130a9ddcaf766d6ce309f8518b434a2537fc1 (patch) | |
tree | 55c67e3ca38c6145be68346701c8a56d71ab78ac /vm_insnhelper.c | |
parent | 315f1ee8a80680fd7aff5fa27abfd965d1906809 (diff) |
merge revision(s) d05f04d27dd86c67e4a8dfff4392f806cf577bdf: [Backport #16931]
Fixed `defined?` against protected method call
Protected methods are restricted to be called according to the
class/module in where it is defined, not the actual receiver's
class. [Bug #16931]
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 2ac006a605..c0d9092a67 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -3551,7 +3551,7 @@ vm_defined(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, rb_num_t op_ case METHOD_VISI_PRIVATE: break; case METHOD_VISI_PROTECTED: - if (!rb_obj_is_kind_of(GET_SELF(), rb_class_real(klass))) { + if (!rb_obj_is_kind_of(GET_SELF(), rb_class_real(me->defined_class))) { break; } case METHOD_VISI_PUBLIC: |