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

ruby-changes:52667

From: shirosaki <ko1@a...>
Date: Sat, 29 Sep 2018 15:47:36 +0900 (JST)
Subject: [ruby-changes:52667] shirosaki:r64879 (trunk): transcode.c: add GC guard on raise

shirosaki	2018-09-29 15:47:30 +0900 (Sat, 29 Sep 2018)

  New Revision: 64879

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64879

  Log:
    transcode.c: add GC guard on raise
    
    * transcode.c (econv_s_search_convpath): add GC guard to fix SEGV
      on raise.
      [Bug #15162] [ruby-core:89172]

  Modified files:
    trunk/transcode.c
Index: transcode.c
===================================================================
--- transcode.c	(revision 64878)
+++ transcode.c	(revision 64879)
@@ -3155,8 +3155,12 @@ econv_s_search_convpath(int argc, VALUE https://github.com/ruby/ruby/blob/trunk/transcode.c#L3155
     convpath = Qnil;
     transcode_search_path(sname, dname, search_convpath_i, &convpath);
 
-    if (NIL_P(convpath))
-        rb_exc_raise(rb_econv_open_exc(sname, dname, ecflags));
+    if (NIL_P(convpath)) {
+	VALUE exc = rb_econv_open_exc(sname, dname, ecflags);
+	RB_GC_GUARD(snamev);
+	RB_GC_GUARD(dnamev);
+	rb_exc_raise(exc);
+    }
 
     if (decorate_convpath(convpath, ecflags) == -1) {
 	VALUE exc = rb_econv_open_exc(sname, dname, ecflags);

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

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