diff --git a/ChangeLog b/ChangeLog index e47ce5da96..8e1d294317 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Oct 7 23:54:33 2012 CHIKANAGA Tomoyuki + + * ext/zlib/zlib.c (zstream_run_func): don't call inflate() when + z->stream.avail_in == 0. it return Z_BUF_ERROR. + but deflate() could be called with z->stream->avail_in == 0 because + it has hidden buffer in z->stream->state (opaque structure). + fix for gem install error. [ruby-dev:46149] [Bug #7040] + Mon Oct 8 23:55:41 2012 Shugo Maeda * eval.c (rb_mod_refinements): new method Module#refinements. diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 6135e8259d..8c3d84d4a3 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -990,6 +990,14 @@ zstream_run_func(void *ptr) break; } + if (z->stream.avail_in == 0 && z->func == &inflate_funcs) { + /* break here because inflate() return Z_BUF_ERROR when avail_in == 0. */ + /* but deflate() could be called with avail_in == 0 (there's hidden buffer + in zstream->state) */ + z->flags |= ZSTREAM_FLAG_IN_STREAM; + break; + } + if (args->stream_output) { state = (int)(VALUE)rb_thread_call_with_gvl(zstream_expand_buffer_protect, (void *)z);