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

ruby-changes:52703

From: ko1 <ko1@a...>
Date: Fri, 5 Oct 2018 00:22:58 +0900 (JST)
Subject: [ruby-changes:52703] ko1:r64915 (trunk): check argument type.

ko1	2018-10-05 00:22:53 +0900 (Fri, 05 Oct 2018)

  New Revision: 64915

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

  Log:
    check argument type.
    
    * iseq.c (iseqw_s_compile): check argument type (T_STRING) to
      avoid SEGV.

  Modified files:
    trunk/iseq.c
Index: iseq.c
===================================================================
--- iseq.c	(revision 64914)
+++ iseq.c	(revision 64915)
@@ -1075,9 +1075,14 @@ iseqw_s_compile(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/iseq.c#L1075
       case 3: path = argv[--i];
       case 2: file = argv[--i];
     }
+
     if (NIL_P(file)) file = rb_fstring_cstr("<compiled>");
+    if (NIL_P(path)) path = file;
     if (NIL_P(line)) line = INT2FIX(1);
 
+    Check_Type(path, T_STRING);
+    Check_Type(file, T_STRING);
+
     return iseqw_new(rb_iseq_compile_with_option(src, file, path, line, 0, opt));
 }
 

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

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