Improve capacity enhancing conditions
MODIFY
src/array.c
src/array.c
@@ -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;
}

MODIFY
src/string.c
src/string.c
@@ -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) {

Improve capacity enhancing conditions