[前][次][番号順一覧][スレッド一覧]

ruby-changes:25067

From: nagachika <ko1@a...>
Date: Tue, 9 Oct 2012 01:40:32 +0900 (JST)
Subject: [ruby-changes:25067] nagachika:r37119 (trunk): * ext/zlib/zlib.c (zstream_run_func): don't call inflate() when

nagachika	2012-10-09 01:40:19 +0900 (Tue, 09 Oct 2012)

  New Revision: 37119

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37119

  Log:
    * 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]

  Modified files:
    trunk/ChangeLog
    trunk/ext/zlib/zlib.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37118)
+++ ChangeLog	(revision 37119)
@@ -1,3 +1,11 @@
+Sun Oct  7 23:54:33 2012  CHIKANAGA Tomoyuki  <nagachika@r...>
+
+	* 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  <shugo@r...>
 
 	* eval.c (rb_mod_refinements): new method Module#refinements.
Index: ext/zlib/zlib.c
===================================================================
--- ext/zlib/zlib.c	(revision 37118)
+++ ext/zlib/zlib.c	(revision 37119)
@@ -990,6 +990,14 @@
 	    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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]