aboutsummaryrefslogtreecommitdiffstats
path: root/test/stringio
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-22 14:14:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-22 14:14:30 +0000
commita197581765fa78c848f3d49233f47ec2e8fc90c0 (patch)
tree5ef26a507eb2c6e1515120252f1893979572c26b /test/stringio
parentc143b9a0ab2f6fd48bb46932329766d9b619b9bf (diff)
downloadruby-a197581765fa78c848f3d49233f47ec2e8fc90c0.tar.gz
stringio.c: use rb_str_append
* ext/stringio/stringio.c (strio_write): use rb_str_append to reuse coderange bits and keep taintedness. [ruby-dev:48118] [Bug #9769] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/stringio')
-rw-r--r--test/stringio/test_stringio.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index c7db91aae1..f4883455f6 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -119,6 +119,17 @@ class TestStringIO < Test::Unit::TestCase
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_mode_error
f = StringIO.new("", "r")
assert_raise(IOError) { f.write("foo") }