mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* complex.c (nucomp_marshal_load): should check the argument.
[ruby-core:31622] * rational.c (nurat_marshal_load): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
359d537878
commit
5274f89201
6 changed files with 25 additions and 1 deletions
|
@ -1,4 +1,9 @@
|
|||
Thu Aug 5 18:25:33 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Thu Aug 5 18:36:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* complex.c (nucomp_marshal_load): should check the argument.
|
||||
[ruby-core:31622]
|
||||
|
||||
* rational.c (nurat_marshal_load): ditto
|
||||
|
||||
* marshal.c (w_float): should not append a dot if no fractal part
|
||||
exists. [ruby-dev:41936]
|
||||
|
|
|
@ -1247,6 +1247,7 @@ static VALUE
|
|||
nucomp_marshal_load(VALUE self, VALUE a)
|
||||
{
|
||||
get_dat1(self);
|
||||
Check_Type(a, T_ARRAY);
|
||||
dat->real = RARRAY_PTR(a)[0];
|
||||
dat->imag = RARRAY_PTR(a)[1];
|
||||
rb_copy_generic_ivar(self, a);
|
||||
|
|
|
@ -1602,6 +1602,7 @@ static VALUE
|
|||
nurat_marshal_load(VALUE self, VALUE a)
|
||||
{
|
||||
get_dat1(self);
|
||||
Check_Type(a, T_ARRAY);
|
||||
dat->num = RARRAY_PTR(a)[0];
|
||||
dat->den = RARRAY_PTR(a)[1];
|
||||
rb_copy_generic_ivar(self, a);
|
||||
|
|
|
@ -633,6 +633,11 @@ class Complex_Test < Test::Unit::TestCase
|
|||
assert_equal(c, c2)
|
||||
assert_instance_of(Complex, c2)
|
||||
end
|
||||
|
||||
bug3656 = '[ruby-core:31622]'
|
||||
assert_raise(TypeError, bug3656) {
|
||||
Complex(1,2).marshal_load(0)
|
||||
}
|
||||
end
|
||||
|
||||
def test_parse
|
||||
|
|
|
@ -427,4 +427,11 @@ END
|
|||
assert_equal(x0, x2)
|
||||
end
|
||||
end
|
||||
|
||||
def test_marshal
|
||||
bug3656 = '[ruby-core:31622]'
|
||||
assert_raise(TypeError, bug3656) {
|
||||
Random.new.marshal_load(0)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -797,6 +797,11 @@ class Rational_Test < Test::Unit::TestCase
|
|||
assert_raise(ZeroDivisionError){
|
||||
Marshal.load("\x04\bU:\rRational[\ai\x06i\x05")
|
||||
}
|
||||
|
||||
bug3656 = '[ruby-core:31622]'
|
||||
assert_raise(TypeError, bug3656) {
|
||||
Rational(1,2).marshal_load(0)
|
||||
}
|
||||
end
|
||||
|
||||
def test_parse
|
||||
|
|
Loading…
Reference in a new issue