Project

General

Profile

Actions

Bug #4274

closed

SEGFAULT: ARGF.gets will crash if first file is not readable!

Added by rbjl (Jan Lelis) over 13 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2p136 (2010-12-25) [i686-linux]
Backport:
[ruby-core:34446]

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

argf_segfault.segfault (1.38 KB) argf_segfault.segfault rbjl (Jan Lelis), 01/13/2011 05:45 AM
argf_segfault.backtrace (2.03 KB) argf_segfault.backtrace rbjl (Jan Lelis), 01/13/2011 05:45 AM
argf_segfault.patch (1023 Bytes) argf_segfault.patch rbjl (Jan Lelis), 01/13/2011 05:45 AM
Actions #1

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

Actions

Also available in: Atom PDF

Like0
Like0