ruby-changes:26100
From: nobu <ko1@a...>
Date: Mon, 3 Dec 2012 19:10:25 +0900 (JST)
Subject: [ruby-changes:26100] nobu:r38157 (trunk): random.c, rational.c: make marshal methods private
nobu 2012-12-03 19:10:14 +0900 (Mon, 03 Dec 2012) New Revision: 38157 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38157 Log: random.c, rational.c: make marshal methods private * random.c (Init_Random), rational.c (Init_Rational): make marshal methods private. [Feature #6539] Modified files: trunk/ChangeLog trunk/random.c trunk/rational.c trunk/test/ruby/test_rand.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38156) +++ ChangeLog (revision 38157) @@ -1,3 +1,8 @@ +Mon Dec 3 19:10:12 2012 Nobuyoshi Nakada <nobu@r...> + + * random.c (Init_Random), rational.c (Init_Rational): make marshal + methods private. [Feature #6539] + Mon Dec 3 18:29:27 2012 Koichi Sasada <ko1@a...> * iseq.h: iseq_catch_table_entry::catch_type should be Index: test/ruby/test_rand.rb =================================================================== --- test/ruby/test_rand.rb (revision 38156) +++ test/ruby/test_rand.rb (revision 38157) @@ -482,7 +482,7 @@ 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 @@ 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 Index: rational.c =================================================================== --- rational.c (revision 38156) +++ rational.c (revision 38157) @@ -2432,9 +2432,9 @@ rb_define_method(rb_cRational, "to_s", nurat_to_s, 0); rb_define_method(rb_cRational, "inspect", nurat_inspect, 0); - rb_define_method(rb_cRational, "marshal_dump", nurat_marshal_dump, 0); + rb_define_private_method(rb_cRational, "marshal_dump", nurat_marshal_dump, 0); compat = rb_define_class_under(rb_cRational, "compatible", rb_cObject); - rb_define_method(compat, "marshal_load", nurat_marshal_load, 1); + rb_define_private_method(compat, "marshal_load", nurat_marshal_load, 1); rb_marshal_define_compat(rb_cRational, compat, nurat_dumper, nurat_loader); /* --- */ Index: random.c =================================================================== --- random.c (revision 38156) +++ random.c (revision 38157) @@ -1463,8 +1463,8 @@ rb_define_method(rb_cRandom, "bytes", random_bytes, 1); rb_define_method(rb_cRandom, "seed", random_get_seed, 0); rb_define_method(rb_cRandom, "initialize_copy", random_copy, 1); - rb_define_method(rb_cRandom, "marshal_dump", random_dump, 0); - rb_define_method(rb_cRandom, "marshal_load", random_load, 1); + rb_define_private_method(rb_cRandom, "marshal_dump", random_dump, 0); + rb_define_private_method(rb_cRandom, "marshal_load", random_load, 1); rb_define_private_method(rb_cRandom, "state", random_state, 0); rb_define_private_method(rb_cRandom, "left", random_left, 0); rb_define_method(rb_cRandom, "==", random_equal, 1); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/