summaryrefslogtreecommitdiff
path: root/test/zlib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-01 02:01:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-01 02:01:38 +0000
commitd70e47dc6b410fa7b6673aba6c3be0372639fda8 (patch)
treec280043fc276f9e481ca1c4b52030f3ff633588e /test/zlib
parentc4c3d86a1fa66eb84ecf38c5a63c5b486755f7b1 (diff)
zlib.c: no buf_filled in zstream
* ext/zlib/zlib.c (zstream): manage capacity and size of `buf` instead of size and separated member `buf_filled`. reported by Christian Jalio (jalio) at https://hackerone.com/reports/211958 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
-rw-r--r--test/zlib/test_zlib.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index 38cb393..b6a4510 100644
--- a/test/zlib/test_zlib.rb
+++ b/test/zlib/test_zlib.rb
@@ -127,6 +127,16 @@ if defined? Zlib
assert_equal("foobar", Zlib::Inflate.inflate(s))
end
+ def test_expand_buffer;
+ z = Zlib::Deflate.new
+ src = "baz" * 1000
+ z.avail_out = 1
+ GC.stress = true
+ s = z.deflate(src, Zlib::FINISH)
+ GC.stress = false
+ assert_equal(src, Zlib::Inflate.inflate(s))
+ end
+
def test_total
z = Zlib::Deflate.new
1000.times { z << "foo" }