From d61dfcc7939199e19c2034c422f3473142c6d0a4 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 14 Jul 2012 07:04:28 +0000 Subject: array.c: no infection by unused separator * array.c (rb_ary_join): should not infected by separator if it is not used. [ruby-core:42161][Bug #5902] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_array.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 16875894ef..a4fda99474 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -920,6 +920,19 @@ class TestArray < Test::Unit::TestCase assert_equal(true, s.tainted?) assert_equal(true, s.untrusted?) + bug5902 = '[ruby-core:42161]' + sep = ":".taint.untrust + + s = @cls[].join(sep) + assert_equal(false, s.tainted?, bug5902) + assert_equal(false, s.untrusted?, bug5902) + s = @cls[1].join(sep) + assert_equal(false, s.tainted?, bug5902) + assert_equal(false, s.untrusted?, bug5902) + s = @cls[1, 2].join(sep) + assert_equal(true, s.tainted?, bug5902) + assert_equal(true, s.untrusted?, bug5902) + e = ''.force_encoding('EUC-JP') u = ''.force_encoding('UTF-8') assert_equal(Encoding::US_ASCII, [[]].join.encoding) -- cgit v1.2.3