summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/array.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/array.c b/src/array.c
index 056d72920..2ce4e5dc6 100644
--- a/src/array.c
+++ b/src/array.c
@@ -619,6 +619,10 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
size = head + argc;
if (tail < a->len) size += a->len - tail;
+
+ if (size < 0 || size > ARY_MAX_SIZE)
+ mrb_raise(mrb, E_ARGUMENT_ERROR, "array size too big");
+
if (size > a->aux.capa)
ary_expand_capa(mrb, a, size);