1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* array.c (rb_ary_fill): check for negative length.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-06-29 10:19:48 +00:00
parent 51bd9cada8
commit 50ba0ce29e
2 changed files with 5 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Sun Jun 29 19:19:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* array.c (rb_ary_fill): check for negative length.
Sun Jun 29 18:09:00 2008 Kouhei Sutou <kou@cozmixng.org>
* NEWS: add an entry for rss.

View file

@ -2413,6 +2413,7 @@ rb_ary_fill(argc, argv, ary)
if (beg < 0) beg = 0;
}
len = NIL_P(arg2) ? RARRAY(ary)->len - beg : NUM2LONG(arg2);
if (len < 0) rb_raise(rb_eIndexError, "negative length (%ld)", len);
break;
}
rb_ary_modify(ary);