aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--test/ruby/test_alias.rb8
-rw-r--r--vm_method.c4
3 files changed, 22 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d720571cdb..ff3c1c0c2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
+Tue Nov 17 23:50:06 2009 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_method.c (rb_alias): should raise TypeError if klass is nil.
+ 1.instance_eval { alias to_string to_s } causes SEGV before this
+ fix.
+
+ * test/ruby/test_alias.rb (test_special_const_alias): ditto.
+
Tue Nov 17 17:53:53 2009 Martin Duerst <duerst@it.aoyama.ac.jp>
- * enc/big5.c, enc/trans/big5.trans, enc/trans/big5-uao-tbl.rb,
+ * enc/big5.c, enc/trans/big5.trans, enc/trans/big5-uao-tbl.rb,
test/ruby/test-transcode.rb: Added Encoding 'Big5-UAO' and transcoding
for it (from Tatsuya Mizuno) (see Bug #1784)
@@ -11,6 +19,7 @@ Tue Nov 17 16:26:24 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_insnhelper.c (opt_case_dispatch_i): gets rid of type-punning
calls.
+
Mon Nov 16 15:51:53 2009 Shugo Maeda <shugo@ruby-lang.org>
* vm_insnhelper.c (vm_call_method): protected singleton methods of
diff --git a/test/ruby/test_alias.rb b/test/ruby/test_alias.rb
index 7f8a32c529..babd763577 100644
--- a/test/ruby/test_alias.rb
+++ b/test/ruby/test_alias.rb
@@ -77,4 +77,12 @@ class TestAlias < Test::Unit::TestCase
end
assert_equal("ABC", x.try(:upcase), '[ruby-dev:38824]')
end
+
+ def test_special_const_alias
+ assert_raise(TypeError) do
+ 1.instance_eval do
+ alias to_string to_s
+ end
+ end
+ end
end
diff --git a/vm_method.c b/vm_method.c
index 557583f5aa..d1c68b58f3 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -857,6 +857,10 @@ rb_alias(VALUE klass, ID name, ID def)
{
rb_method_entry_t *orig_me;
+ if (NIL_P(klass)) {
+ rb_raise(rb_eTypeError, "no class to make alias");
+ }
+
rb_frozen_class_p(klass);
if (klass == rb_cObject) {
rb_secure(4);