mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 22:45:03 +02:00
random.c, rational.c: make marshal methods private
* random.c (Init_Random), rational.c (Init_Rational): make marshal methods private. [Feature #6539] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c4f9dd2626
commit
4d73f95068
4 changed files with 14 additions and 9 deletions
|
@ -482,7 +482,7 @@ END
|
|||
def test_marshal
|
||||
bug3656 = '[ruby-core:31622]'
|
||||
assert_raise(TypeError, bug3656) {
|
||||
Random.new.marshal_load(0)
|
||||
Random.new.__send__(:marshal_load, 0)
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -496,19 +496,19 @@ END
|
|||
|
||||
def test_marshal_load_frozen
|
||||
r = Random.new(0)
|
||||
d = r.marshal_dump
|
||||
d = r.__send__(:marshal_dump)
|
||||
r.freeze
|
||||
assert_raise(RuntimeError, '[Bug #6540]') do
|
||||
r.marshal_load(d)
|
||||
r.__send__(:marshal_load, d)
|
||||
end
|
||||
end
|
||||
|
||||
def test_marshal_load_insecure
|
||||
r = Random.new(0)
|
||||
d = r.marshal_dump
|
||||
d = r.__send__(:marshal_dump)
|
||||
l = proc do
|
||||
$SAFE = 4
|
||||
r.marshal_load(d)
|
||||
r.__send__(:marshal_load, d)
|
||||
end
|
||||
assert_raise(SecurityError, '[Bug #6540]') do
|
||||
l.call
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue