1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
yugui 2009-08-08 15:33:47 +00:00
parent 59dc7d4c96
commit b1e7a961d2
4 changed files with 47 additions and 4 deletions

View file

@ -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