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

ruby-changes:34106

From: nagachika <ko1@a...>
Date: Wed, 28 May 2014 00:36:40 +0900 (JST)
Subject: [ruby-changes:34106] nagachika:r46187 (ruby_2_1): merge revision(s) r45534: [Backport #9709]

nagachika	2014-05-28 00:36:32 +0900 (Wed, 28 May 2014)

  New Revision: 46187

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

  Log:
    merge revision(s) r45534: [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_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/string.c
    branches/ruby_2_1/test/ruby/test_string.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 46186)
+++ ruby_2_1/ChangeLog	(revision 46187)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Wed May 28 00:29:02 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]
+
 Wed May 28 00:23:11 2014  NARUSE, Yui  <naruse@r...>
 
 	* lib/xmlrpc/client.rb (do_rpc): don't check body length.
Index: ruby_2_1/string.c
===================================================================
--- ruby_2_1/string.c	(revision 46186)
+++ ruby_2_1/string.c	(revision 46187)
@@ -2098,7 +2098,7 @@ str_buf_cat(VALUE str, const char *ptr, https://github.com/ruby/ruby/blob/trunk/ruby_2_1/string.c#L2098
     if (capa <= total) {
 	while (total > capa) {
 	    if (capa + termlen >= LONG_MAX / 2) {
-		capa = (total + 4095) / 4096;
+		capa = (total + 4095) / 4096 * 4096;
 		break;
 	    }
 	    capa = (capa + termlen) * 2;
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 46186)
+++ ruby_2_1/version.h	(revision 46187)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.2"
 #define RUBY_RELEASE_DATE "2014-05-28"
-#define RUBY_PATCHLEVEL 108
+#define RUBY_PATCHLEVEL 109
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 5
Index: ruby_2_1/test/ruby/test_string.rb
===================================================================
--- ruby_2_1/test/ruby/test_string.rb	(revision 46186)
+++ ruby_2_1/test/ruby/test_string.rb	(revision 46187)
@@ -2219,6 +2219,17 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_string.rb#L2219
       assert_equal("foo", "" =~ //)
     RUBY
   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_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45534


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

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