ruby-changes:30648
From: nagachika <ko1@a...>
Date: Thu, 29 Aug 2013 21:55:17 +0900 (JST)
Subject: [ruby-changes:30648] nagachika:r42727 (ruby_2_0_0): merge revision(s) 42720: [Backport #8829]
nagachika 2013-08-29 21:55:11 +0900 (Thu, 29 Aug 2013) New Revision: 42727 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42727 Log: merge revision(s) 42720: [Backport #8829] * 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. Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/ext/zlib/zlib.c branches/ruby_2_0_0/test/zlib/test_zlib.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 42726) +++ ruby_2_0_0/ChangeLog (revision 42727) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Thu Aug 29 21:51:33 2013 Eric Hodel <drbrain@s...> + + * 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. + Thu Aug 29 21:28:56 2013 Nobuyoshi Nakada <nobu@r...> * vm_insnhelper.c (vm_call_method): a method entry refers the based Index: ruby_2_0_0/ext/zlib/zlib.c =================================================================== --- ruby_2_0_0/ext/zlib/zlib.c (revision 42726) +++ ruby_2_0_0/ext/zlib/zlib.c (revision 42727) @@ -1074,11 +1074,13 @@ loop: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/zlib/zlib.c#L1074 } 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); Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 42726) +++ ruby_2_0_0/version.h (revision 42727) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-08-29" -#define RUBY_PATCHLEVEL 298 +#define RUBY_PATCHLEVEL 299 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_0_0/test/zlib/test_zlib.rb =================================================================== --- ruby_2_0_0/test/zlib/test_zlib.rb (revision 42726) +++ ruby_2_0_0/test/zlib/test_zlib.rb (revision 42727) @@ -232,6 +232,12 @@ if defined? Zlib https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/zlib/test_zlib.rb#L232 end class TestZlibInflate < Test::Unit::TestCase + def test_class_inflate_dictionary + assert_raises(Zlib::NeedDict) do + Zlib::Inflate.inflate([0x08,0x3C,0x0,0x0,0x0,0x0].pack("c*")) + end + end + def test_initialize assert_raise(Zlib::StreamError) { Zlib::Inflate.new(-1) } Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r42720 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/