Skip to content

Commit

Permalink
array.c: check size bound by ARY_MAX_SIZE not MRB_INT_MAX.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Mar 9, 2022
1 parent 6fa5aaf commit 6e964bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/array.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 6e964bd

Please sign in to comment.