Skip to content

Commit fccd96c

Browse files
committed
Add stricter assertions on CC access
1 parent 640a2f1 commit fccd96c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vm_callinfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ static inline const struct rb_callable_method_entry_struct *
418418
vm_cc_cme(const struct rb_callcache *cc)
419419
{
420420
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
421+
VM_ASSERT(cc->klass != Qundef || !vm_cc_markable(cc));
422+
VM_ASSERT(cc_check_class(cc->klass));
421423
VM_ASSERT(cc->call_ == NULL || // not initialized yet
422424
!vm_cc_markable(cc) ||
423425
cc->cme_ != NULL);
@@ -430,6 +432,8 @@ vm_cc_call(const struct rb_callcache *cc)
430432
{
431433
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
432434
VM_ASSERT(cc->call_ != NULL);
435+
VM_ASSERT(cc->klass != Qundef || !vm_cc_markable(cc));
436+
VM_ASSERT(cc_check_class(cc->klass));
433437
return cc->call_;
434438
}
435439

0 commit comments

Comments
 (0)