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

ruby-changes:34073

From: usa <ko1@a...>
Date: Tue, 27 May 2014 11:48:58 +0900 (JST)
Subject: [ruby-changes:34073] usa:r46154 (ruby_2_0_0): merge revision(s) 45534: [Backport #9709]

usa	2014-05-27 11:48:46 +0900 (Tue, 27 May 2014)

  New Revision: 46154

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

  Log:
    merge revision(s) 45534: [Backport #9709]
    
    * string.c (str_buf_cat): should round up the capacity by 4KiB,
      but not number of rooms.  [ruby-core:61886] [Bug #9709]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/string.c
    branches/ruby_2_0_0/test/ruby/test_string.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 46153)
+++ ruby_2_0_0/ChangeLog	(revision 46154)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Tue May 27 11:48:22 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (str_buf_cat): should round up the capacity by 4KiB,
+	  but not number of rooms.  [ruby-core:61886] [Bug #9709]
+
 Tue May 27 11:46:03 2014  NARUSE, Yui  <naruse@r...>
 
 	* lib/xmlrpc/client.rb (do_rpc): don't check body length.
Index: ruby_2_0_0/string.c
===================================================================
--- ruby_2_0_0/string.c	(revision 46153)
+++ ruby_2_0_0/string.c	(revision 46154)
@@ -1925,7 +1925,7 @@ str_buf_cat(VALUE str, const char *ptr, https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/string.c#L1925
     if (capa <= total) {
 	while (total > capa) {
 	    if (capa + 1 >= LONG_MAX / 2) {
-		capa = (total + 4095) / 4096;
+		capa = (total + 4095) / 4096 * 4096;
 		break;
 	    }
 	    capa = (capa + 1) * 2;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 46153)
+++ ruby_2_0_0/version.h	(revision 46154)
@@ -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 "2014-05-27"
-#define RUBY_PATCHLEVEL 483
+#define RUBY_PATCHLEVEL 484
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 5
Index: ruby_2_0_0/test/ruby/test_string.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_string.rb	(revision 46153)
+++ ruby_2_0_0/test/ruby/test_string.rb	(revision 46154)
@@ -2193,6 +2193,17 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_string.rb#L2193
     assert_equal(false, "\u3042".byteslice(0, 2).valid_encoding?)
     assert_equal(false, ("\u3042"*10).byteslice(0, 20).valid_encoding?)
   end
+
+  def test_LSHIFT_neary_long_max
+    return unless @cls == String
+    assert_ruby_status([], <<-'end;', '[ruby-core:61886] [Bug #9709]')
+      begin
+        a = "a" * 0x4000_0000
+        a << "a" * 0x1_0000
+      rescue NoMemoryError
+      end
+    end;
+  end
 end
 
 class TestString2 < TestString

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


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

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