Project

General

Profile

Actions

Bug #2601

closed

BasicObject.initialize should raise an error

Added by marcandre (Marc-Andre Lafortune) almost 15 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2dev (2010-01-12 trunk 26295) [x86_64-darwin10.2.0]
Backport:
[ruby-core:27577]

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

Actions #1

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

Actions #2

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

Actions

Also available in: Atom PDF

Like0
Like0Like0