mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 04:24:04 +02:00
rational.c: check load
* rational.c (nurat_loader, nurat_marshal_load): check if loading values are Integer. [ruby-core:78071] [Bug #12918] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0f9ce57b86
commit
e41ebc50dc
2 changed files with 40 additions and 26 deletions
|
@ -646,6 +646,10 @@ class Rational_Test < Test::Unit::TestCase
|
|||
assert_equal(9, c2.instance_variable_get(:@ivar))
|
||||
assert_instance_of(Rational, c2)
|
||||
|
||||
assert_raise(TypeError){
|
||||
Marshal.load("\x04\bU:\rRational[\ai\x060")
|
||||
}
|
||||
|
||||
assert_raise(ZeroDivisionError){
|
||||
Marshal.load("\x04\bU:\rRational[\ai\x06i\x05")
|
||||
}
|
||||
|
@ -664,6 +668,10 @@ class Rational_Test < Test::Unit::TestCase
|
|||
assert_nothing_raised(bug6625) do
|
||||
assert_equal(Rational(1, 2), Marshal.load(dump), bug6625)
|
||||
end
|
||||
dump = "\x04\x08o:\x0dRational\x07:\x11@denominatori\x07:\x0f@numerator0"
|
||||
assert_raise(TypeError) do
|
||||
Marshal.load(dump)
|
||||
end
|
||||
end
|
||||
|
||||
def test_parse
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue