summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-27 15:36:32 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-27 15:36:32 +0000
commitcd0a89b0931d51015e4e94b010926f0c75767cee (patch)
treefbbffee961abcea767a1ed70f60014f2ec174e99 /string.c
parent909291085c87b41d6718c2630ee49210eb9d9684 (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
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 983c2a1166..7f29cea2b6 100644
--- a/string.c
+++ b/string.c
@@ -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;