summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-09 03:44:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-09 03:44:55 +0000
commit68537a42198a8ef6ef3699527ebfdf05989676a4 (patch)
treed5acbf79af9327841983615096c3e7a307b8105e /string.c
parent0192e15b4ce61e38a239f3a3ae9c19e1d6efaa21 (diff)
string.c: fix capacity
* 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/trunk@45534 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 511374c7b8..ccf265738e 100644
--- a/string.c
+++ b/string.c
@@ -2029,7 +2029,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;