mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
array.c: raise IndexError for negative length in rb_ary_fill
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d520759f65
commit
27b35eddd6
2 changed files with 4 additions and 0 deletions
|
@ -1,3 +1,6 @@
|
|||
Fri Oct 26 05:48:57 UTC 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
||||
* array.c: raise IndexError for negative length in rb_ary_fill
|
||||
|
||||
Wed Oct 25 07:12:03 2007 James Edward Gray II <jeg2@ruby-lang.org>
|
||||
|
||||
* lib/net/telnet.rb (Net::Telnet#login): Allowing "passphrase" in
|
||||
|
|
1
array.c
1
array.c
|
@ -2127,6 +2127,7 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
|
|||
if (beg < 0) beg = 0;
|
||||
}
|
||||
len = NIL_P(arg2) ? RARRAY_LEN(ary) - beg : NUM2LONG(arg2);
|
||||
if (len < 0) rb_raise(rb_eIndexError, "negative length (%ld)", len);
|
||||
break;
|
||||
}
|
||||
rb_ary_modify(ary);
|
||||
|
|
Loading…
Add table
Reference in a new issue