From 4079f0da51c1e226ce6e09597e32ab116d1c7812 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 22 Nov 2021 12:32:47 -0800 Subject: [PATCH] Check that cb / ocb exist before marking executable If YJIT isn't enabled, or hasn't finished booting, cb / ocb could be null. This commit just checks to make sure they're available before marking as executable Co-Authored-By: Maxime Chevalier-Boisvert Co-Authored-By: Kevin Newton --- yjit_iface.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/yjit_iface.c b/yjit_iface.c index 39967a89a9..739d639ae6 100644 --- a/yjit_iface.c +++ b/yjit_iface.c @@ -962,8 +962,15 @@ rb_yjit_iseq_update_references(const struct rb_iseq_constant_body *body) //block->code_page = rb_gc_location(block->code_page); } } - cb_mark_all_executable(cb); - cb_mark_all_executable(ocb); + + /* If YJIT isn't initialized, then cb or ocb could be NULL. */ + if (cb) { + cb_mark_all_executable(cb); + } + + if (ocb) { + cb_mark_all_executable(ocb); + } } // Free the yjit resources associated with an iseq