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

ruby-changes:58522

From: Jeremy <ko1@a...>
Date: Thu, 31 Oct 2019 16:39:26 +0900 (JST)
Subject: [ruby-changes:58522] ebc884461b (master): [ruby/stringio] Remove taint support

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

From ebc884461b0d8c3144c05abeb793e381903de6b2 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Fri, 18 Oct 2019 12:39:49 -0700
Subject: [ruby/stringio] Remove taint support

Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.

https://github.com/ruby/stringio/commit/60ee9ccd95

diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index d6db112..4dd5fb4 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -623,7 +623,6 @@ strio_copy(VALUE copy, VALUE orig) https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L623
 	strio_free(DATA_PTR(copy));
     }
     DATA_PTR(copy) = ptr;
-    OBJ_INFECT(copy, orig);
     RBASIC(copy)->flags &= ~STRIO_READWRITE;
     RBASIC(copy)->flags |= RBASIC(orig)->flags & STRIO_READWRITE;
     ++ptr->count;
@@ -1443,7 +1442,6 @@ strio_write(VALUE self, VALUE str) https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L1442
     if (ptr->pos == olen) {
 	if (enc == ascii8bit || enc2 == ascii8bit) {
 	    rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc);
-	    OBJ_INFECT(ptr->string, str);
 	}
 	else {
 	    rb_str_buf_append(ptr->string, str);
@@ -1452,9 +1450,7 @@ strio_write(VALUE self, VALUE str) https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L1450
     else {
 	strio_extend(ptr, ptr->pos, len);
 	memmove(RSTRING_PTR(ptr->string)+ptr->pos, RSTRING_PTR(str), len);
-	OBJ_INFECT(ptr->string, str);
     }
-    OBJ_INFECT(ptr->string, self);
     RB_GC_GUARD(str);
     ptr->pos += len;
     return len;
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index 07fe350..663a33b 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -180,17 +180,6 @@ class TestStringIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/stringio/test_stringio.rb#L180
     f.close unless f.closed?
   end
 
-  def test_write_infection
-    bug9769 = '[ruby-dev:48118] [Bug #9769]'
-    s = "".untaint
-    f = StringIO.new(s, "w")
-    f.print("bar".taint)
-    f.close
-    assert_predicate(s, :tainted?, bug9769)
-  ensure
-    f.close unless f.closed?
-  end
-
   def test_write_encoding
     s = "".force_encoding(Encoding::UTF_8)
     f = StringIO.new(s)
-- 
cgit v0.10.2


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

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