Array size can be cause integer overflow; fix #3710

parent 39779b33
...@@ -169,7 +169,7 @@ ary_expand_capa(mrb_state *mrb, struct RArray *a, mrb_int len) ...@@ -169,7 +169,7 @@ ary_expand_capa(mrb_state *mrb, struct RArray *a, mrb_int len)
{ {
mrb_int capa = a->aux.capa; mrb_int capa = a->aux.capa;
if (len > ARY_MAX_SIZE) { if (len > ARY_MAX_SIZE || len < 0) {
size_error: size_error:
mrb_raise(mrb, E_ARGUMENT_ERROR, "array size too big"); mrb_raise(mrb, E_ARGUMENT_ERROR, "array size too big");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment