diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-10 09:48:15 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-10 09:48:15 +0000 |
commit | 79f1b5b1a8b084d5f77dba405b91ce2415b85ec0 (patch) | |
tree | 4be10c328f64343124edca7d4469c91c7c1fc0ea /array.c | |
parent | cc3ede1ba8b59115e1a5abf02873e92e9841a00b (diff) | |
download | ruby-79f1b5b1a8b084d5f77dba405b91ce2415b85ec0.tar.gz ruby-79f1b5b1a8b084d5f77dba405b91ce2415b85ec0.tar.xz ruby-79f1b5b1a8b084d5f77dba405b91ce2415b85ec0.zip |
added some checks for request size.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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); |