array.c: check size bound by ARY_MAX_SIZE not MRB_INT_MAX.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-03-08 17:16:49 +09:00
parent 6fa5aaf694
commit 6e964bd1c6
+1 -1
View File
@@ -716,7 +716,7 @@ mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val)
mrb_raisef(mrb, E_INDEX_ERROR, "index %i out of array", n - len);
}
}
if (n == MRB_INT_MAX) {
if (n >= ARY_MAX_SIZE) {
mrb_raise(mrb, E_INDEX_ERROR, "index too big");
}
if (len <= n) {