Project

General

Profile

Backport #8467

Rewinding and iterating through gzipped IO leads to segmentation fault

Added by vicente.mundim (Vicente Mundim) almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:55220]

Description

The following steps reproduce the bug in 2.0.0:

  • Create a file and gzip it in a terminal:

    echo "some content" > compressed_file && gzip compressed_file

Then start a IRB session with the following code:

require 'zlib'
filename = "compressed_file.gz"
io = Zlib::GzipReader.new(open(filename, 'rb'))
io.rewind
io.each {} # segmentation_fault in Ruby 2.0.0

This works in Ruby 1.9.3, 1.9.2, and 1.8.7.


Files

zlib_bug.rb (152 Bytes) zlib_bug.rb File with code to reproduce bug vicente.mundim (Vicente Mundim), 06/01/2013 12:15 AM
ruby_2013-05-31-121414_vm-imac.crash (8.99 KB) ruby_2013-05-31-121414_vm-imac.crash Crash report vicente.mundim (Vicente Mundim), 06/01/2013 12:15 AM

Associated revisions

Revision aa8cc01a
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

zlib.c: check EOF

  • ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc), (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]

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

Revision 41014
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

zlib.c: check EOF

  • ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc), (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]

Revision 41014
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

zlib.c: check EOF

  • ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc), (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]

Revision 41014
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

zlib.c: check EOF

  • ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc), (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]

Revision 41014
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

zlib.c: check EOF

  • ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc), (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]

Revision 41014
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

zlib.c: check EOF

  • ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc), (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]

Revision 41014
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

zlib.c: check EOF

  • ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc), (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]

Revision cc94db60
Added by nagachika (Tomoyuki Chikanaga) almost 6 years ago

merge revision(s) 41014: [Backport #8467]

* ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
  (gzreader_gets): check EOF.  [ruby-core:55220] [Bug #8467]

* ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
  (gzreader_gets): check EOF.  [ruby-core:55220] [Bug #8467]

* lib/cgi/util.rb: All class methods moduleized.

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

Revision 41073
Added by nagachika (Tomoyuki Chikanaga) almost 6 years ago

merge revision(s) 41014: [Backport #8467]

* ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
  (gzreader_gets): check EOF.  [ruby-core:55220] [Bug #8467]

* ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
  (gzreader_gets): check EOF.  [ruby-core:55220] [Bug #8467]

* lib/cgi/util.rb: All class methods moduleized.

History

#1

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

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

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


zlib.c: check EOF

  • ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc), (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 2.0.0: REQUIRED
#3

Updated by nagachika (Tomoyuki Chikanaga) almost 6 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby trunk to Backport200
  • Category deleted (lib)
  • Status changed from Closed to Assigned
  • Assignee set to nagachika (Tomoyuki Chikanaga)
#4

Updated by nagachika (Tomoyuki Chikanaga) almost 6 years ago

  • Status changed from Assigned to Closed

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


merge revision(s) 41014: [Backport #8467]

* ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
  (gzreader_gets): check EOF.  [ruby-core:55220] [Bug #8467]

* ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
  (gzreader_gets): check EOF.  [ruby-core:55220] [Bug #8467]

* lib/cgi/util.rb: All class methods moduleized.

Also available in: Atom PDF