Project

General

Profile

Bug #5473

Raise in method_missing causes infinite loop

Added by calamitas (Peter Vanbroekhoven) over 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3dev (2011-10-11 revision 33457) [i386-darwin9.8.0]
Backport:
[ruby-core:40287]

Description

=begin
The following code causes an infinite loop:

class ::Object

def method_missing(m, *a, &b)
  raise ArgumentError.new("haha")
end

end

1.foo

This is due to the raise calling (({to_str})) on the exception, which isn't defined. So a (({method_missing})) that also covers the (({Exception})) class and that contains a (({raise})) (at least the version with one argument) causes an infinite loop.

I'm a bit hesitant to call this a bug, except that the pattern above happened in code that works on Ruby 1.8 and breaks on 1.9.
=end

Associated revisions

Revision a2229db3
Added by nobu (Nobuyoshi Nakada) about 7 years ago

  • vm_method.c (Init_eval_method): copy basic methods to Exception. [ruby-core:40287][Bug #5473]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 34983
Added by nobu (Nobuyoshi Nakada) about 7 years ago

  • vm_method.c (Init_eval_method): copy basic methods to Exception. [ruby-core:40287][Bug #5473]

Revision 34983
Added by nobu (Nobuyoshi Nakada) about 7 years ago

  • vm_method.c (Init_eval_method): copy basic methods to Exception. [ruby-core:40287][Bug #5473]

Revision 34983
Added by nobu (Nobuyoshi Nakada) about 7 years ago

  • vm_method.c (Init_eval_method): copy basic methods to Exception. [ruby-core:40287][Bug #5473]

Revision 34983
Added by nobu (Nobuyoshi Nakada) about 7 years ago

  • vm_method.c (Init_eval_method): copy basic methods to Exception. [ruby-core:40287][Bug #5473]

Revision 34983
Added by nobu (Nobuyoshi Nakada) about 7 years ago

  • vm_method.c (Init_eval_method): copy basic methods to Exception. [ruby-core:40287][Bug #5473]

Revision 34983
Added by nobu (Nobuyoshi Nakada) about 7 years ago

  • vm_method.c (Init_eval_method): copy basic methods to Exception. [ruby-core:40287][Bug #5473]

Revision 76e3af82
Added by nobu (Nobuyoshi Nakada) 4 months ago

Warn redefinitions of some methods on Object

[Bug #5473] [Bug #14670] [Bug #15382]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 66262
Added by nobu (Nobuyoshi Nakada) 4 months ago

Warn redefinitions of some methods on Object

[Bug #5473] [Bug #14670] [Bug #15382]

Revision 66262
Added by nobu (Nobuyoshi Nakada) 4 months ago

Warn redefinitions of some methods on Object

[Bug #5473] [Bug #14670] [Bug #15382]

History

Updated by ko1 (Koichi Sasada) about 7 years ago

  • Status changed from Open to Assigned
  • Assignee set to ko1 (Koichi Sasada)
#2

Updated by nobu (Nobuyoshi Nakada) about 7 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34983.
Peter, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • vm_method.c (Init_eval_method): copy basic methods to Exception. [ruby-core:40287][Bug #5473]

Also available in: Atom PDF