diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-27 15:36:32 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-27 15:36:32 +0000 |
commit | cd0a89b0931d51015e4e94b010926f0c75767cee (patch) | |
tree | fbbffee961abcea767a1ed70f60014f2ec174e99 | |
parent | 909291085c87b41d6718c2630ee49210eb9d9684 (diff) |
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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | string.c | 2 | ||||
-rw-r--r-- | test/ruby/test_string.rb | 11 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 18 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Wed May 28 00:29:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@ruby-lang.org> * lib/xmlrpc/client.rb (do_rpc): don't check body length. @@ -2098,7 +2098,7 @@ str_buf_cat(VALUE str, const char *ptr, long len) 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; diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 7ce1c0666c..57cea652b1 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -2219,6 +2219,17 @@ class TestString < Test::Unit::TestCase 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 @@ -1,6 +1,6 @@ #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 |