diff options
| author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-18 02:34:20 +0000 |
|---|---|---|
| committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-18 02:34:20 +0000 |
| commit | 29d1ef89a7fd8b66630f243f342d41d79003e232 (patch) | |
| tree | e6d8bdb135123dacacb41dedadbda53bef5c7dfa /ext | |
| parent | 392560e72e0b3b06c6ed873f1b7da7535450f476 (diff) | |
| download | ruby-29d1ef89a7fd8b66630f243f342d41d79003e232.tar.gz ruby-29d1ef89a7fd8b66630f243f342d41d79003e232.tar.xz ruby-29d1ef89a7fd8b66630f243f342d41d79003e232.zip | |
* ext/zlib/zlib.c (zstream_run): fixed SEGV. [ruby-core:4712]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/zlib/zlib.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 15f90681f..b05e5264c 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -709,6 +709,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 = ""; @@ -718,6 +719,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) { |
