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

ruby-changes:58840

From: Koichi <ko1@a...>
Date: Tue, 19 Nov 2019 17:01:20 +0900 (JST)
Subject: [ruby-changes:58840] a5fe08fdd9 (master): care about TAG_FATAL.

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

From a5fe08fdd9d11f12a6837291ee588ab933a823b6 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Tue, 19 Nov 2019 16:56:56 +0900
Subject: care about TAG_FATAL.

TAG_FATAL represents interpreter closing state and ec->errinfo
contains FIXNUM (eTerminateSignal, etc). If we need to change the
state, then errinfo is also changed because TAG_RAISE assumes that
ec->errinfo contains a Exception object.

Without this patch, TAG_FATAL is ignored and no ec->errinfo change
so that it causes critical issue.
[Bug #16177]

diff --git a/load.c b/load.c
index 5b27fd1..7772e74 100644
--- a/load.c
+++ b/load.c
@@ -1034,7 +1034,10 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception) https://github.com/ruby/ruby/blob/trunk/load.c#L1034
     if (ftptr) load_unlock(RSTRING_PTR(path), !state);
 
     if (state) {
-        if (exception) {
+        if (state == TAG_FATAL) {
+            EC_JUMP_TAG(ec, state);
+        }
+        else if (exception) {
             /* usually state == TAG_RAISE only, except for
              * rb_iseq_load_iseq in load_iseq_eval case */
             VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, Qundef);
-- 
cgit v0.10.2


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

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