зеркало из https://github.com/github/ruby.git
added some checks for request size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e74149056b
Коммит
59dc82ae1a
|
@ -1,3 +1,7 @@
|
|||
Thu Apr 10 18:42:13 2003 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* array.c (rb_ary_times): added some checks for request size.
|
||||
|
||||
Thu Apr 10 03:22:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* variable.c (rb_mod_name): always return empty string for
|
||||
|
|
4
array.c
4
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче