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_unshift_m): need to check number of arguments.

[ruby-talk:74189]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-06-23 17:40:14 +00:00
parent 9d05b9a4b3
commit d749616333
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Tue Jun 24 02:40:09 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* array.c (rb_ary_unshift_m): need to check number of arguments.
[ruby-talk:74189]
Mon Jun 23 23:59:56 2003 Minero Aoki <aamine@loveruby.net>
* io.c (io_close): missing prototype.

View file

@ -427,7 +427,12 @@ rb_ary_unshift_m(argc, argv, ary)
VALUE ary;
{
long len = RARRAY(ary)->len;
if (argc < 0) {
rb_raise(rb_eArgError, "negative number of arguments");
}
if (argc == 0) return ary;
/* make rooms by setting the last item */
rb_ary_store(ary, len + argc - 1, Qnil);