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
* 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
StringIO.new makes the buffer IO.default_external, while
StringIO.new("".dup) makes source encoding which is defaulted to
UTF-8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Skip two tests on AIX because zconf.h in zlib does not correctly
recognize _LARGE_FILES in AIX. The problem was already reported
to zlib, and skip these tests until it is fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
When you change this to true, you may need to add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/zlib/zlib.c (gzfile_reset): preserve ZSTREAM_FLAG_GZFILE
[Bug #10101]
* test/zlib/test_zlib.rb (test_rewind): test each_byte
We must preserve the ZSTREAM_FLAG_GZFILE flag to prevent
zstream_detach_buffer from:
a) returning Qnil and breaking out of the `each_byte' loop
b) yielding a large string to each_byte
Note: the test case in bug report takes a long time. I found this
bug because I noticed the massive time descrepancy between
`each_byte' and `readbyte' loop before this patch. With this patch,
`each_byte' and `readbyte' both take very long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
need a dictionary but are being decompressed by Zlib::Inflate.inflate
(which has no option to set a dictionary). Now Zlib::NeedDict is
raised instead of crashing. [ruby-trunk - Bug #8829]
* test/zlib/test_zlib.rb (TestZlibInflate): Test for the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This allows zlib streams to be processed without huge memory growth.
[Feature #6612]
* NEWS: ditto
* ext/zlib/zlib.c (zstream_expand_buffer): Uses rb_yield when a block
is given for streaming support. Refactored to use
zstream_expand_buffer_into to remove duplicate code.
* ext/zlib/zlib.c (zstream_expand_buffer_protect): Added wrapper
function to pass jump state back through GVL-free section to allow
zstream clean-up before terminating the ruby call.
* ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Acquire GVL to
yield processed chunk of output stream.
* ext/zlib/zlib.c (zstream_detach_buffer): When a block is given,
returns Qnil mid-stream and yields the output buffer at the end of
the stream.
* test/zlib/test_zlib.rb: Updated tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
processing. rb_block_given_p() is not callable without the GVL.
* ext/zlib/extconf.rb: ditto
* NEWS: ditto
* test/zlib/test_zlib.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This allows zlib streams to be processed without huge memory growth.
[Feature #6612]
* NEWS: ditto
* ext/zlib/zlib.c (zstream_expand_buffer): Uses rb_yield when a block
is given for streaming support. Refactored to use
zstream_expand_buffer_into to remove duplicate code.
* ext/zlib/zlib.c (zstream_expand_buffer_protect): Added wrapper
function to pass jump state back through GVL-free section to allow
zstream clean-up before terminating the ruby call.
* ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Acquire GVL to
yield processed chunk of output stream.
* ext/zlib/zlib.c (zstream_detach_buffer): When a block is given,
returns Qnil mid-stream and yields the output buffer at the end of
the stream.
* ext/zlib/extconf.rb: Update INCFLAGS to find internal.h for
rb_thread_call_with_gvl
* test/zlib/test_zlib.rb: Updated tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
patched by headius (Charles Nutter). [ruby-core:44859] [Bug #6398]
* test/zlib/test_zlib.rb (test_deflate): add a test for Zlib.deflate.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
encoding testcases for GzipReader#read. read() emits
Encoding.default_external in contrast to read(size) emits BINARY.
See also: http://bugs.jruby.org/6208
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Zlib::Inflate#add_dictionary to allow users to pre-specify
for using during #inflate. [ruby-trunk - Feature #5937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
binmode explicitly for fixing test error on Windows. This is consistent
with r34243.
[ruby-dev:45149] [Bug #5812]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
gzip header is readable to avoid SEGV.
* test/zlib/test_zlib.rb (test_corrupted_header): Test it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
string to the encoding of the buffer.
* hash.c (rb_any_hash): typo fixed.
* ext/zlib/zlib.c (rb_gzwriter_write): oops, IO string conversion
need to be done by to_s.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
using to_str, not to_s.
* ext/zlib/zlib.c (rb_gzwriter_write): need proper conversion
according to gz encoding.
* ext/zlib/zlib.c (rb_gzreader_ungetc): convert string encoding
before unget.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e