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

ruby-changes:29021

From: nagachika <ko1@a...>
Date: Wed, 5 Jun 2013 00:45:17 +0900 (JST)
Subject: [ruby-changes:29021] nagachika:r41073 (ruby_2_0_0): merge revision(s) 41014: [Backport #8467]

nagachika	2013-06-05 00:44:57 +0900 (Wed, 05 Jun 2013)

  New Revision: 41073

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

  Log:
    merge revision(s) 41014: [Backport #8467]
    
    * ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
      (gzreader_gets): check EOF.  [ruby-core:55220] [Bug #8467]
    
    * ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
      (gzreader_gets): check EOF.  [ruby-core:55220] [Bug #8467]
    
    * lib/cgi/util.rb: All class methods moduleized.

  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 41072)
+++ ruby_2_0_0/ChangeLog	(revision 41073)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Wed Jun  5 00:38:46 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
+	  (gzreader_gets): check EOF.  [ruby-core:55220] [Bug #8467]
+
 Wed Jun  5 00:32:18 2013  Tanaka Akira  <akr@f...>
 
 	* test/ruby/test_require.rb: Remove temporally files in the tests.
Index: ruby_2_0_0/ext/zlib/zlib.c
===================================================================
--- ruby_2_0_0/ext/zlib/zlib.c	(revision 41072)
+++ ruby_2_0_0/ext/zlib/zlib.c	(revision 41073)
@@ -2707,7 +2707,7 @@ gzfile_read(struct gzfile *gz, long len) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/zlib/zlib.c#L2707
     if (len == 0) return rb_str_new(0, 0);
     if (len < 0) return Qnil;
     dst = zstream_shift_buffer(&gz->z, len);
-    gzfile_calc_crc(gz, dst);
+    if (!NIL_P(dst)) gzfile_calc_crc(gz, dst);
     return dst;
 }
 
@@ -2770,6 +2770,7 @@ gzfile_read_all(struct gzfile *gz) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/zlib/zlib.c#L2770
     }
 
     dst = zstream_detach_buffer(&gz->z);
+    if (NIL_P(dst)) return dst;
     gzfile_calc_crc(gz, dst);
     OBJ_TAINT(dst);
     return gzfile_newstr(gz, dst);
@@ -2816,6 +2817,7 @@ gzfile_getc(struct gzfile *gz) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/zlib/zlib.c#L2817
 	buf = gz->z.buf;
 	len = rb_enc_mbclen(RSTRING_PTR(buf), RSTRING_END(buf), gz->enc);
 	dst = gzfile_read(gz, len);
+	if (NIL_P(dst)) return dst;
 	return gzfile_newstr(gz, dst);
     }
 }
@@ -4041,6 +4043,7 @@ gzreader_gets(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/zlib/zlib.c#L4043
 		n = limit;
 	    }
 	    dst = zstream_shift_buffer(&gz->z, n);
+	    if (NIL_P(dst)) return dst;
 	    gzfile_calc_crc(gz, dst);
 	    dst = gzfile_newstr(gz, dst);
 	}
@@ -4102,6 +4105,7 @@ gzreader_gets(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/zlib/zlib.c#L4105
 
     gz->lineno++;
     dst = gzfile_read(gz, n);
+    if (NIL_P(dst)) return dst;
     if (rspara) {
 	gzreader_skip_linebreaks(gz);
     }
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 41072)
+++ ruby_2_0_0/version.h	(revision 41073)
@@ -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-06-05"
-#define RUBY_PATCHLEVEL 207
+#define RUBY_PATCHLEVEL 208
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 6
Index: ruby_2_0_0/test/zlib/test_zlib.rb
===================================================================
--- ruby_2_0_0/test/zlib/test_zlib.rb	(revision 41072)
+++ ruby_2_0_0/test/zlib/test_zlib.rb	(revision 41073)
@@ -686,6 +686,7 @@ if defined? Zlib https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/zlib/test_zlib.rb#L686
     end
 
     def test_rewind
+      bug8467 = '[ruby-core:55220] [Bug #8467]'
       t = Tempfile.new("test_zlib_gzip_reader_rewind")
       t.close
       Zlib::GzipWriter.open(t.path) {|gz| gz.print("foo") }
@@ -695,6 +696,11 @@ if defined? Zlib https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/zlib/test_zlib.rb#L696
         f.rewind
         assert_equal("foo", f.read)
       end
+      open(t.path, "rb") do |f|
+        gz = Zlib::GzipReader.new(f)
+        gz.rewind
+        assert_equal(["foo"], gz.to_a, bug8467)
+      end
       t.close(true)
     end
 

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r41014


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

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