ruby-changes:14017
From: shugo <ko1@a...>
Date: Tue, 17 Nov 2009 23:53:49 +0900 (JST)
Subject: [ruby-changes:14017] Ruby:r25826 (trunk): * vm_method.c (rb_alias): should raise TypeError if klass is nil.
shugo 2009-11-17 23:53:32 +0900 (Tue, 17 Nov 2009) New Revision: 25826 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25826 Log: * 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. Modified files: trunk/ChangeLog trunk/test/ruby/test_alias.rb trunk/vm_method.c Index: ChangeLog =================================================================== --- ChangeLog (revision 25825) +++ ChangeLog (revision 25826) @@ -1,6 +1,14 @@ +Tue Nov 17 23:50:06 2009 Shugo Maeda <shugo@r...> + + * 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@i...> - * 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 @@ * vm_insnhelper.c (opt_case_dispatch_i): gets rid of type-punning calls. + Mon Nov 16 15:51:53 2009 Shugo Maeda <shugo@r...> * vm_insnhelper.c (vm_call_method): protected singleton methods of Index: vm_method.c =================================================================== --- vm_method.c (revision 25825) +++ vm_method.c (revision 25826) @@ -857,6 +857,10 @@ { 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); Index: test/ruby/test_alias.rb =================================================================== --- test/ruby/test_alias.rb (revision 25825) +++ test/ruby/test_alias.rb (revision 25826) @@ -77,4 +77,12 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/