summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/array.c b/array.c
index 9eda004130..7e8c12b683 100644
--- a/array.c
+++ b/array.c
@@ -2419,7 +2419,7 @@ rb_ary_fill(argc, argv, ary)
if (len < 0) {
return ary;
}
- if (len > ARY_MAX_SIZE - beg) {
+ if (beg >= ARY_MAX_SIZE || len > ARY_MAX_SIZE - beg) {
rb_raise(rb_eArgError, "argument too big");
}
end = beg + len;