summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-11 07:42:27 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-11 07:42:27 +0000
commit5168fb54e327be6414e53af54c149948a94e623b (patch)
tree5e8320057bca4983b6d98e71fbbac21b270581c7 /test
parentd2dd18ed16c977e278c18946ca679ba13b5722f6 (diff)
tainted string should be tainted.
* hash.c (hash_aset_str): create frozen string for tainted objects. (should not use fsting table on this case). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_hash.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 798bd2fe60..d915e52bde 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -300,6 +300,17 @@ class TestHash < Test::Unit::TestCase
assert_same "ABC".freeze, a.keys[0]
end
+ def test_tainted_string_key
+ str = 'str'.taint
+ h = {}
+ h[str] = nil
+ key = h.keys.first
+ assert_equal true, str.tainted?
+ assert_equal false, str.frozen?
+ assert_equal true, key.tainted?
+ assert_equal true, key.frozen?
+ end
+
def test_EQUAL # '=='
h1 = @cls[ "a" => 1, "c" => 2 ]
h2 = @cls[ "a" => 1, "c" => 2, 7 => 35 ]