summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--random.c4
-rw-r--r--rational.c4
-rw-r--r--test/ruby/test_rand.rb10
4 files changed, 14 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 11f95d4..885efdd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Dec 3 19:10:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * random.c (Init_Random), rational.c (Init_Rational): make marshal
+ methods private. [Feature #6539]
+
Mon Dec 3 18:29:27 2012 Koichi Sasada <ko1@atdot.net>
* iseq.h: iseq_catch_table_entry::catch_type should be
diff --git a/random.c b/random.c
index e7e4ea7..50db6ec 100644
--- a/random.c
+++ b/random.c
@@ -1463,8 +1463,8 @@ Init_Random(void)
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);
diff --git a/rational.c b/rational.c
index 855b187..e4201dd 100644
--- a/rational.c
+++ b/rational.c
@@ -2432,9 +2432,9 @@ Init_Rational(void)
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);
/* --- */
diff --git a/test/ruby/test_rand.rb b/test/ruby/test_rand.rb
index fe88305..b482773 100644
--- a/test/ruby/test_rand.rb
+++ b/test/ruby/test_rand.rb
@@ -482,7 +482,7 @@ END
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 @@ END
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