[前][次][番号順一覧][スレッド一覧]

ruby-changes:23825

From: tadf <ko1@a...>
Date: Sun, 3 Jun 2012 10:26:54 +0900 (JST)
Subject: [ruby-changes:23825] tadf:r35876 (trunk): * complex.c (nucomp_marshal_load):

tadf	2012-06-03 10:26:41 +0900 (Sun, 03 Jun 2012)

  New Revision: 35876

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35876

  Log:
    * complex.c (nucomp_marshal_load): [ruby-core:45394]
    * rational.c (nurat_marshal_load): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/complex.c
    trunk/rational.c
    trunk/test/ruby/test_complex.rb
    trunk/test/ruby/test_rational.rb

Index: complex.c
===================================================================
--- complex.c	(revision 35875)
+++ complex.c	(revision 35876)
@@ -1259,6 +1259,10 @@
 nucomp_marshal_load(VALUE self, VALUE a)
 {
     get_dat1(self);
+
+    rb_check_frozen(self);
+    rb_check_trusted(self);
+
     Check_Type(a, T_ARRAY);
     if (RARRAY_LEN(a) != 2)
 	rb_raise(rb_eArgError, "marshaled complex must have an array whose length is 2 but %ld", RARRAY_LEN(a));
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35875)
+++ ChangeLog	(revision 35876)
@@ -1,3 +1,8 @@
+Sun Jun  3 10:23:32 2012  Tadayoshi Funaba  <tadf@d...>
+
+	* complex.c (nucomp_marshal_load): [ruby-core:45394]
+	* rational.c (nurat_marshal_load): ditto.
+
 Sun Jun  3 03:15:46 2012  NARUSE, Yui  <naruse@r...>
 
 	* regparse.c (onig_number_of_names): suppress a warning.
Index: test/ruby/test_complex.rb
===================================================================
--- test/ruby/test_complex.rb	(revision 35875)
+++ test/ruby/test_complex.rb	(revision 35876)
@@ -661,6 +661,11 @@
     assert_raise(TypeError, bug3656) {
       Complex(1,2).marshal_load(0)
     }
+
+    c = Complex(1,2)
+    c.freeze
+    assert(c.frozen?)
+    assert_raise(RuntimeError){c.marshal_load([2,3])}
   end
 
   def test_parse
Index: test/ruby/test_rational.rb
===================================================================
--- test/ruby/test_rational.rb	(revision 35875)
+++ test/ruby/test_rational.rb	(revision 35876)
@@ -831,6 +831,11 @@
     assert_raise(TypeError, bug3656) {
       Rational(1,2).marshal_load(0)
     }
+
+    c = Rational(1,2)
+    c.freeze
+    assert(c.frozen?)
+    assert_raise(RuntimeError){c.marshal_load([2,3])}
   end
 
   def test_parse
Index: rational.c
===================================================================
--- rational.c	(revision 35875)
+++ rational.c	(revision 35876)
@@ -1605,6 +1605,10 @@
 nurat_marshal_load(VALUE self, VALUE a)
 {
     get_dat1(self);
+
+    rb_check_frozen(self);
+    rb_check_trusted(self);
+
     Check_Type(a, T_ARRAY);
     if (RARRAY_LEN(a) != 2)
 	rb_raise(rb_eArgError, "marshaled rational must have an array whose length is 2 but %ld", RARRAY_LEN(a));

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]