1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@25826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2009-11-17 14:53:32 +00:00
parent 10b7e0e4ad
commit 86d46b5459
3 changed files with 22 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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);