From d70e47dc6b410fa7b6673aba6c3be0372639fda8 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 1 May 2017 02:01:38 +0000 Subject: 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 --- test/zlib/test_zlib.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/zlib') diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index 38cb393872..b6a4510b80 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" } -- cgit v1.2.3