Improve capacity enhancing conditions

This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-01-06 14:53:00 +09:00
parent c6a1172592
commit 885d929398
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -182,10 +182,10 @@ ary_expand_capa(mrb_state *mrb, struct RArray *a, size_t len)
capa *= 2;
}
else {
goto size_error;
capa = len;
}
}
if (capa < len || capa > MRB_INT_MAX) {
if (capa < len || capa > ARY_MAX_SIZE) {
goto size_error;
}
+1 -1
View File
@@ -169,7 +169,7 @@ str_buf_cat(mrb_state *mrb, struct RString *s, const char *ptr, size_t len)
capa *= 2;
}
else {
goto size_error;
capa = total;
}
}
if (capa < total || capa > MRB_INT_MAX) {