diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-17 14:53:32 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-17 14:53:32 +0000 |
commit | be9d729bd825aecca4b7f43a5f2cebc64c51f477 (patch) | |
tree | 05d1686530f384f51a55a8b301e60637d3438280 /vm_method.c | |
parent | 685e54db9095d1d8f7938861cdc50ce1cd3c9779 (diff) | |
download | ruby-be9d729bd825aecca4b7f43a5f2cebc64c51f477.tar.gz ruby-be9d729bd825aecca4b7f43a5f2cebc64c51f477.tar.xz ruby-be9d729bd825aecca4b7f43a5f2cebc64c51f477.zip |
* 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.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c index 557583f5a..d1c68b58f 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); |