[前][次][番号順一覧][スレッド一覧]

ruby-changes:57842

From: Takashi <ko1@a...>
Date: Fri, 20 Sep 2019 21:50:53 +0900 (JST)
Subject: [ruby-changes:57842] 9e171b1fa0 (master): Fix wrong allocation failure handling

https://git.ruby-lang.org/ruby.git/commit/?id=9e171b1fa0

From 9e171b1fa0b4e2e5b0bf82da11b4b511c602c336 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Fri, 20 Sep 2019 21:50:00 +0900
Subject: Fix wrong allocation failure handling

`iseq->body->jit_unit->compile_info` should not be referenced before
the null check of `iseq->body->jit_unit`.

diff --git a/mjit.c b/mjit.c
index 26a2a4e..3ae9410 100644
--- a/mjit.c
+++ b/mjit.c
@@ -368,11 +368,11 @@ mjit_add_iseq_to_process(const rb_iseq_t *iseq, const struct rb_mjit_compile_inf https://github.com/ruby/ruby/blob/trunk/mjit.c#L368
 
     iseq->body->jit_func = (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC;
     create_unit(iseq);
-    if (compile_info != NULL)
-        iseq->body->jit_unit->compile_info = *compile_info;
     if (iseq->body->jit_unit == NULL)
         // Failure in creating the unit.
         return;
+    if (compile_info != NULL)
+        iseq->body->jit_unit->compile_info = *compile_info;
 
     CRITICAL_SECTION_START(3, "in add_iseq_to_process");
     add_to_list(iseq->body->jit_unit, &unit_queue);
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]