summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/array.c4
-rw-r--r--src/string.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/array.c b/src/array.c
index 54ff26721..420907866 100644
--- a/src/array.c
+++ b/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;
}
diff --git a/src/string.c b/src/string.c
index 976c34687..b4746545a 100644
--- a/src/string.c
+++ b/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) {