summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-10 09:48:15 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-10 09:48:15 +0000
commit59dc82ae1afdd2cd7bf4f23b458123c3214aa831 (patch)
tree4be10c328f64343124edca7d4469c91c7c1fc0ea /array.c
parente74149056bae388e35d4a4cab8cfa38114eb16b1 (diff)
added some checks for request size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/array.c b/array.c
index 74bf094..cecf427 100644
--- a/array.c
+++ b/array.c
@@ -1529,9 +1529,13 @@ rb_ary_times(ary, times)
}
len = NUM2LONG(times);
+ if (len == 0) return rb_ary_new2(0);
if (len < 0) {
rb_raise(rb_eArgError, "negative argument");
}
+ if (LONG_MAX/len < RARRAY(ary)->len) {
+ rb_raise(rb_eArgError, "argument too big");
+ }
len *= RARRAY(ary)->len;
ary2 = ary_new(rb_obj_class(ary), len);