Issue #7040 has been updated by nagachika (Tomoyuki C.).
Assignee set to drbrain (Eric H.)
Hello,
I’d like to switch to ruby-core, but I don’t know how to do it on
redmine…
Anyway, I’ve found that zstream_run_func() leaks Z_BUF_ERROR because
deflate() could return Z_BUF_ERROR even when z->stream.avail_out > 0.
My tiny patch below prevent the exception, but I’m not confident at all
it’s right way to fix this issue.
Issue #7040 has been updated by nagachika (Tomoyuki C.).
File zlib_inflate_buf_error.patch added
Category changed from core to ext
Assignee changed from drbrain (Eric H.) to nagachika (Tomoyuki
Chikanaga)
Hello,
I’ve investigated this little more deeper.
If inflate() (aka z->func->run()) return under condition which
z->stream.avail_in == z->stream.avail_out == 0, current
zstream_run_func() call inflate() once more even though there’s no input
available. In that case inflate() return Z_BUF_ERROR.
However, deflate() have hidden input buffer in z->stream.state (opaque
structure) and should be called even when z->stream.avail_in == 0 (while
z->stream.avail_out == 0).
I think zstream_run_func() should break from while loop when
zstream->avail_in == 0 only if z->func->run == inflate.
I will commit an attached patch tomorrow if there’s no objection.