summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2021-11-11 11:55:35 -0500
committerPeter Zhu <peter@peterzhu.ca>2021-11-11 14:08:38 -0500
commit84202963c52e02cecad3e6b2fad478bfbeee1bc7 (patch)
tree6386a26ce4b2a78947f8dcbe1774976fe9ecc5d1 /vm_insnhelper.c
parenta9a94540d68b523ecc4e2181e50b320cd5d176f1 (diff)
[Bug #18329] Fix crash when calling non-existent super method
The cme is NULL when a method does not exist, so check it before accessing the callcache.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5108
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 86bdfd2fb6..b9950f4fe2 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1936,7 +1936,8 @@ vm_search_method_fastpath(VALUE cd_owner, struct rb_call_data *cd, VALUE klass)
#if OPT_INLINE_METHOD_CACHE
if (LIKELY(vm_cc_class_check(cc, klass))) {
- if (LIKELY(!METHOD_ENTRY_INVALIDATED(vm_cc_cme(cc)))) {
+ const struct rb_callable_method_entry_struct *cme = vm_cc_cme(cc);
+ if (LIKELY(cme && !METHOD_ENTRY_INVALIDATED(cme))) {
VM_ASSERT(callable_method_entry_p(vm_cc_cme(cc)));
RB_DEBUG_COUNTER_INC(mc_inline_hit);
VM_ASSERT(vm_cc_cme(cc) == NULL || // not found