From fccd96cc6c3cc9f500dc87ae9be65aaa212b02fa Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 6 Aug 2025 13:53:00 -0700 Subject: [PATCH] Add stricter assertions on CC access --- vm_callinfo.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vm_callinfo.h b/vm_callinfo.h index 3b6880e320..79ccbfa7ab 100644 --- a/vm_callinfo.h +++ b/vm_callinfo.h @@ -418,6 +418,8 @@ static inline const struct rb_callable_method_entry_struct * vm_cc_cme(const struct rb_callcache *cc) { VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache)); + VM_ASSERT(cc->klass != Qundef || !vm_cc_markable(cc)); + VM_ASSERT(cc_check_class(cc->klass)); VM_ASSERT(cc->call_ == NULL || // not initialized yet !vm_cc_markable(cc) || cc->cme_ != NULL); @@ -430,6 +432,8 @@ vm_cc_call(const struct rb_callcache *cc) { VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache)); VM_ASSERT(cc->call_ != NULL); + VM_ASSERT(cc->klass != Qundef || !vm_cc_markable(cc)); + VM_ASSERT(cc_check_class(cc->klass)); return cc->call_; }