summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-18 02:34:20 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-18 02:34:20 +0000
commit2082947ccfe3b7150a586951e942276aad49dc86 (patch)
treeb9f776b024cb145ca389353e1f91be6461d22856 /ext
parentefe47bf3f7e109aee55a144a8c88d41e91251359 (diff)
downloadruby-2082947ccfe3b7150a586951e942276aad49dc86.tar.gz
ruby-2082947ccfe3b7150a586951e942276aad49dc86.tar.xz
ruby-2082947ccfe3b7150a586951e942276aad49dc86.zip
* ext/zlib/zlib.c (zstream_run): fixed SEGV. [ruby-core:4712]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/zlib.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 98f60cbcb..c8c4407d0 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -706,6 +706,7 @@ zstream_run(z, src, len, flush)
{
uInt n;
int err;
+ volatile VALUE guard;
if (NIL_P(z->input) && len == 0) {
z->stream.next_in = "";
@@ -715,6 +716,10 @@ zstream_run(z, src, len, flush)
zstream_append_input(z, src, len);
z->stream.next_in = RSTRING(z->input)->ptr;
z->stream.avail_in = RSTRING(z->input)->len;
+ /* keep reference to `z->input' so as not to be garbage collected
+ after zstream_reset_input() and prevent `z->stream.next_in'
+ from dangling. */
+ guard = z->input;
}
if (z->stream.avail_out == 0) {