summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-08 15:33:47 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-08 15:33:47 +0000
commitb1e7a961d2b728a66cf1c0a706de344b2b78e812 (patch)
tree1a7444c25f65e23442088e5c031ddfc7d2b2ed8f /test
parent59dc7d4c9641204275fb9d93ffbd99baf3c58a98 (diff)
merges r24396 from trunk into ruby_1_9_1.
-- * lib/pp.rb (guard_inspect_key): untrust internal hash to prevent unexpected SecurityError. * test/ruby/test_object.rb: add a test for [ruby-dev:38982]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_object.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb
index 2116c6a216..14f189685b 100644
--- a/test/ruby/test_object.rb
+++ b/test/ruby/test_object.rb
@@ -405,4 +405,40 @@ class TestObject < Test::Unit::TestCase
assert_equal(true, s.untrusted?)
assert_equal(true, s.tainted?)
end
+
+ def test_exec_recursive
+ Thread.current[:__recursive_key__] = nil
+ a = [[]]
+ a.inspect
+
+ assert_nothing_raised do
+ -> do
+ $SAFE = 4
+ begin
+ a.hash
+ rescue ArgumentError
+ end
+ end.call
+ end
+
+ -> do
+ assert_nothing_raised do
+ $SAFE = 4
+ a.inspect
+ end
+ end.call
+
+ -> do
+ o = Object.new
+ def o.to_ary(x); end
+ def o.==(x); $SAFE = 4; false; end
+ a = [[o]]
+ b = []
+ b << b
+
+ assert_nothing_raised do
+ b == a
+ end
+ end.call
+ end
end