Backport #2519

__method__ can return NULL (and therefore crash ruby)

Added by marcandre (Marc-Andre Lafortune) over 2 years ago. Updated about 1 year ago.

[ruby-core:27296]
Status:Closed Start date:12/23/2009
Priority:High Due date:
Assignee:shyouhei (Shyouhei Urabe) % Done:

100%

Category:-
Target version:-

Description

In Ruby 1.8.7 and latest 1.8.8:

$ cat ohoh.rb 
puts __method__

$ ruby18dev -e "load 'ohoh.rb'"
val (null) id 140734799802560/Users/work/test/ohoh.rb:1:in `to_s': NULL pointer given (ArgumentError)
	from /Users/work/test/ohoh.rb:1:in `puts'
	from /Users/work/test/ohoh.rb:1
	from -e:1:in `load'
	from -e:1


Doing __method__.inspect instead will crash Ruby

Associated revisions

Revision 26159
Added by nobu over 2 years ago

* eval.c (rb_load): initialize orig_func. [ruby-core:27296]

Revision 28246
Added by shyouhei almost 2 years ago

merge revision(s) 26159: * eval.c (rb_load): initialize orig_func. [ruby-core:27296]

History

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r26159.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Updated by shyouhei (Shyouhei Urabe) about 2 years ago

  • Status changed from Closed to Assigned
  • Assignee set to shyouhei (Shyouhei Urabe)

Updated by shyouhei (Shyouhei Urabe) almost 2 years ago

  • Status changed from Assigned to Closed
This issue was solved with changeset r28246.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF