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

ruby-changes:18853

From: naruse <ko1@a...>
Date: Tue, 15 Feb 2011 16:08:26 +0900 (JST)
Subject: [ruby-changes:18853] Ruby:r30878 (trunk): * array.c (inspect_ary): don't taint the inspected result of a

naruse	2011-02-15 16:08:18 +0900 (Tue, 15 Feb 2011)

  New Revision: 30878

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30878

  Log:
    * array.c (inspect_ary): don't taint the inspected result of a
      recursive array.

  Modified files:
    trunk/ChangeLog
    trunk/array.c
    trunk/test/ruby/test_string.rb

Index: array.c
===================================================================
--- array.c	(revision 30877)
+++ array.c	(revision 30878)
@@ -1743,7 +1743,7 @@
     long i;
     VALUE s, str;
 
-    if (recur) return rb_tainted_str_new2("[...]");
+    if (recur) return rb_usascii_str_new_cstr("[...]");
     str = rb_str_buf_new2("[");
     for (i=0; i<RARRAY_LEN(ary); i++) {
 	s = rb_inspect(RARRAY_PTR(ary)[i]);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30877)
+++ ChangeLog	(revision 30878)
@@ -1,3 +1,8 @@
+Mon Feb 14 15:00:16 2011  NARUSE, Yui  <naruse@r...>
+
+	* array.c (inspect_ary): don't taint the inspected result of a
+	  recursive array.
+
 Tue Feb 15 15:43:29 2011  NARUSE, Yui  <naruse@r...>
 
 	* encoding.c (rb_enc_compatible): change the rule for empty strings:
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 30877)
+++ test/ruby/test_string.rb	(revision 30878)
@@ -1693,14 +1693,6 @@
     }
   end
 
-  def test_tainted_str_new
-    a = []
-    a << a
-    s = a.inspect
-    assert(s.tainted?)
-    assert_equal("[[...]]", s)
-  end
-
   class S2 < String
   end
   def test_str_new4

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

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