diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-28 20:36:21 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-28 20:36:21 +0000 |
commit | 9f2f1fcbc8fc896e234a1b2939ba660ec56b55f2 (patch) | |
tree | 9c95760326ed3f1b27da4a86ae5229e9bb5cb91f /ext/zlib | |
parent | c94b0e8568fb608ad0890fa9e3bf26997e6a6b50 (diff) |
* ext/zlib/zlib.c (zstream_run): Fix handling of deflate streams that
need a dictionary but are being decompressed by Zlib::Inflate.inflate
(which has no option to set a dictionary). Now Zlib::NeedDict is
raised instead of crashing. [ruby-trunk - Bug #8829]
* test/zlib/test_zlib.rb (TestZlibInflate): Test for the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib')
-rw-r--r-- | ext/zlib/zlib.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 918bad6b7d..df2a2501b2 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1074,11 +1074,13 @@ loop: } if (err == Z_NEED_DICT) { VALUE self = (VALUE)z->stream.opaque; - VALUE dicts = rb_ivar_get(self, id_dictionaries); - VALUE dict = rb_hash_aref(dicts, rb_uint2inum(z->stream.adler)); - if (!NIL_P(dict)) { - rb_inflate_set_dictionary(self, dict); - goto loop; + if (self) { + VALUE dicts = rb_ivar_get(self, id_dictionaries); + VALUE dict = rb_hash_aref(dicts, rb_uint2inum(z->stream.adler)); + if (!NIL_P(dict)) { + rb_inflate_set_dictionary(self, dict); + goto loop; + } } } raise_zlib_error(err, z->stream.msg); |