Bug #2601
closedBasicObject.initialize should raise an error
Description
=begin
While having fun cloning BasicObject (see issue 2443), I found the amusing bug that :initialize could successfully be sent to BasicObject, creating all sorts of havoc.
$ rubydev -e "BasicObject.send :initialize; puts Object.ancestors" # => Loops indefinitely
$ rubydev -e "BasicObject.send :initialize, String; puts 42.upcase" # => Segmentation Fault
It was even possible to change the root of all Ruby classes without running into trouble:
$ rubydev -e '
SuperBasicObject = BasicObject.clone
BasicObject.send :initialize, SuperBasicObject
puts BasicObject.superclass
'
==> SuperBasicObject¶
I fixed it, although changes might be required depending on the outcome of issue #2443.
=end
Updated by matz (Yukihiro Matsumoto) almost 15 years ago
=begin
Hi,
In message "Re: [ruby-core:27577] [Bug #2601] BasicObject#initialize should raise an error"
on Wed, 13 Jan 2010 11:55:23 +0900, Marc-Andre Lafortune redmine@ruby-lang.org writes:
|While having fun cloning BasicObject (see issue 2443), I found the amusing bug that :initialize could successfully be sent to BasicObject, creating all sorts of havoc.
Thank you for reporting. Although it's fixed, I have to mention that
it is BasicObject.initialize, not BasicObject#initialize.
matz.
=end
Updated by marcandre (Marc-Andre Lafortune) almost 15 years ago
- Subject changed from BasicObject#initialize should raise an error to BasicObject.initialize should raise an error
=begin
=end