diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-03 00:06:40 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-03 00:06:40 +0000 |
commit | cab726cface40ef953c748c2aa77596757ca14d4 (patch) | |
tree | 21cc65c6da20749e07d1d559cd31552f8b522686 /enum.c | |
parent | 967001d9da6a2f26736e092dba924748fa80d099 (diff) |
* enum.c (enum_first): should check negative length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r-- | enum.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -654,6 +654,9 @@ enum_first(int argc, VALUE *argv, VALUE obj) rb_scan_args(argc, argv, "01", &n); len = NUM2LONG(n); if (len == 0) return rb_ary_new2(0); + if (len < 0) { + rb_raise(rb_eArgError, "negative length"); + } ary[0] = len; ary[1] = rb_ary_new2(len); } |