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

ruby-changes:40799

From: naruse <ko1@a...>
Date: Fri, 4 Dec 2015 13:10:08 +0900 (JST)
Subject: [ruby-changes:40799] naruse:r52878 (trunk): Revert r52872 "string.c: should not taint fstring"

naruse	2015-12-04 13:10:00 +0900 (Fri, 04 Dec 2015)

  New Revision: 52878

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

  Log:
    Revert r52872 "string.c: should not taint fstring"
    
    This reverts commit b887c7c20ab81b50ed7cb8c7db3218c443985d6b.

  Modified files:
    trunk/ChangeLog
    trunk/string.c
    trunk/test/ruby/test_object.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52877)
+++ ChangeLog	(revision 52878)
@@ -3,11 +3,6 @@ Fri Dec  4 11:22:40 2015  Nobuyoshi Naka https://github.com/ruby/ruby/blob/trunk/ChangeLog#L3
 	* thread.c (rb_thread_setname): name must be ascii-compatible, as
 	  pthread APIs do not accept legacy wide char strings.
 
-Thu Dec  3 16:02:17 2015  Nobuyoshi Nakada  <nobu@r...>
-
-	* string.c (rb_obj_as_string): fstring should not be infected.
-	  TODO: other frozen strings also may not be.
-
 Thu Dec  3 15:39:21 2015  SHIBATA Hiroshi  <hsbt@r...>
 
 	* lib/scanf.rb: fixed double words typo.
Index: string.c
===================================================================
--- string.c	(revision 52877)
+++ string.c	(revision 52878)
@@ -1247,9 +1247,7 @@ rb_obj_as_string(VALUE obj) https://github.com/ruby/ruby/blob/trunk/string.c#L1247
     str = rb_funcall(obj, idTo_s, 0);
     if (!RB_TYPE_P(str, T_STRING))
 	return rb_any_to_s(obj);
-    if (!FL_SET(str, RSTRING_FSTR) && FL_ABLE(obj))
-	/* fstring must not be tainted, at least */
-	OBJ_INFECT_RAW(str, obj);
+    OBJ_INFECT(str, obj);
     return str;
 }
 
Index: test/ruby/test_object.rb
===================================================================
--- test/ruby/test_object.rb	(revision 52877)
+++ test/ruby/test_object.rb	(revision 52878)
@@ -755,15 +755,6 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L755
       end
     EOS
     assert_match(/\bToS\u{3042}:/, x)
-
-    name = "X".freeze
-    x = Object.new.taint
-    class<<x;self;end.class_eval {define_method(:to_s) {name}}
-    assert_same(name, x.to_s)
-    assert_not_predicate(name, :tainted?)
-    assert_raise(RuntimeError) {name.taint}
-    assert_equal("X", [x].join(""))
-    assert_not_predicate(name, :tainted?)
   end
 
   def test_inspect

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

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