summaryrefslogtreecommitdiff
path: root/test/zlib
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-14 09:17:55 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-14 09:17:55 +0000
commit7c9c2bc1dd470cd4794d6891b21ee1fc61f401e0 (patch)
tree04cf52e468e9c6fdfb44821c86437552584d78db /test/zlib
parentd893c123f6b021254b21c920e182d3c64967f5d5 (diff)
Zlib::GzipReader#pos underflows after calling #ungetbyte or #ungetc at start of file [Bug #13616]
patched by Andrew Haines <andrew@haines.org.nz> [ruby-core:81488] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
-rw-r--r--test/zlib/test_zlib.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index b6a4510..d53717e 100644
--- a/test/zlib/test_zlib.rb
+++ b/test/zlib/test_zlib.rb
@@ -663,6 +663,18 @@ if defined? Zlib
}
end
+ def test_ungetc_at_start_of_file
+ s = "".dup
+ w = Zlib::GzipWriter.new(StringIO.new(s))
+ w << "abc"
+ w.close
+ r = Zlib::GzipReader.new(StringIO.new(s))
+
+ r.ungetc ?!
+
+ assert_equal(-1, r.pos, "[ruby-core:81488][Bug #13616]")
+ end
+
def test_open
Tempfile.create("test_zlib_gzip_reader_open") {|t|
t.close