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
This commit is contained in:
nobu 2017-05-01 02:01:38 +00:00
parent c4c3d86a1f
commit d70e47dc6b
2 changed files with 69 additions and 68 deletions

View file

@ -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" }