ruby-changes:16879
From: mame <ko1@a...>
Date: Thu, 5 Aug 2010 20:55:05 +0900 (JST)
Subject: [ruby-changes:16879] Ruby:r28874 (ruby_1_9_2): merges r28869 from trunk into ruby_1_9_2.
mame 2010-08-05 20:54:48 +0900 (Thu, 05 Aug 2010) New Revision: 28874 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28874 Log: merges r28869 from trunk into ruby_1_9_2. -- * complex.c (nucomp_marshal_load): should check the argument. [ruby-core:31622] * rational.c (nurat_marshal_load): ditto Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/complex.c branches/ruby_1_9_2/rational.c branches/ruby_1_9_2/test/ruby/test_complex.rb branches/ruby_1_9_2/test/ruby/test_rand.rb branches/ruby_1_9_2/test/ruby/test_rational.rb Index: ruby_1_9_2/complex.c =================================================================== --- ruby_1_9_2/complex.c (revision 28873) +++ ruby_1_9_2/complex.c (revision 28874) @@ -1239,6 +1239,7 @@ 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); Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 28873) +++ ruby_1_9_2/ChangeLog (revision 28874) @@ -1,3 +1,10 @@ +Thu Aug 5 18:36:11 2010 Nobuyoshi Nakada <nobu@r...> + + * complex.c (nucomp_marshal_load): should check the argument. + [ruby-core:31622] + + * rational.c (nurat_marshal_load): ditto + Mon Aug 2 16:34:32 2010 NAKAMURA Usaku <usa@r...> * thread_win32.c (native_thread_join): need to wait thread, of course. Index: ruby_1_9_2/test/ruby/test_rand.rb =================================================================== --- ruby_1_9_2/test/ruby/test_rand.rb (revision 28873) +++ ruby_1_9_2/test/ruby/test_rand.rb (revision 28874) @@ -415,4 +415,11 @@ assert_equal(r1, r2) } end + + def test_marshal + bug3656 = '[ruby-core:31622]' + assert_raise(TypeError, bug3656) { + Random.new.marshal_load(0) + } + end end Index: ruby_1_9_2/test/ruby/test_complex.rb =================================================================== --- ruby_1_9_2/test/ruby/test_complex.rb (revision 28873) +++ ruby_1_9_2/test/ruby/test_complex.rb (revision 28874) @@ -633,6 +633,11 @@ 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 Index: ruby_1_9_2/test/ruby/test_rational.rb =================================================================== --- ruby_1_9_2/test/ruby/test_rational.rb (revision 28873) +++ ruby_1_9_2/test/ruby/test_rational.rb (revision 28874) @@ -797,6 +797,11 @@ 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 Index: ruby_1_9_2/rational.c =================================================================== --- ruby_1_9_2/rational.c (revision 28873) +++ ruby_1_9_2/rational.c (revision 28874) @@ -1577,6 +1577,7 @@ 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/