Bug #4274
closedSEGFAULT: ARGF.gets will crash if first file is not readable!
Description
=begin
Hi, welcome to crash golf ;).
ruby -e 'gets rescue gets' CRASH!
or some alternative forms of it:
ARGV.unshift 'filename_that_does_not_exist'
ARGF.gets rescue nil
ARGF.gets
or
$*.unshift'X'
$<.fileno rescue $<.fileno
However, if the first arg is readable, everything will be fine.
I've produced that error on various 1.9 versions.
1.8.7 (tested on p330) does not segfault, but displays a weird error message:
ruby -e 'gets rescue gets' CRASH!
-e:1:in gets': private method
gets' called for false:FalseClass (NoMethodError)
Appended the segfault info and a patch.
J-_-L
=end
Files
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r30536.
Jan, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end