diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-27 07:51:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-27 07:51:27 +0000 |
commit | a5f18c1f9d6e0917d7351c354c0f6245684cbd20 (patch) | |
tree | 3555544d58d375a900412f3202fcbbe8f1260e74 /enumerator.c | |
parent | f25daa254146c782ca50e6fc707f8f132e896e93 (diff) | |
download | bundler-a5f18c1f9d6e0917d7351c354c0f6245684cbd20.tar.gz |
enumerator.c: check arg size
* enumerator.c (enumerator_each): ensure argument array size is int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r-- | enumerator.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/enumerator.c b/enumerator.c index 07916e5af5..51c09597a7 100644 --- a/enumerator.c +++ b/enumerator.c @@ -447,6 +447,9 @@ enumerator_each(int argc, VALUE *argv, VALUE obj) struct enumerator *e = enumerator_ptr(obj = rb_obj_dup(obj)); VALUE args = e->args; if (args) { +#if SIZEOF_INT < SIZEOF_LONG + rb_long2int(RARRAY_LEN(args) + argc); +#endif args = rb_ary_dup(args); rb_ary_cat(args, argv, argc); } @@ -1009,7 +1012,7 @@ enumerator_size(VALUE obj) } if (rb_respond_to(e->size, id_call)) { if (e->args) { - int argc = RARRAY_LENINT(e->args); + int argc = (int)RARRAY_LEN(e->args); VALUE *argv = RARRAY_PTR(e->args); return rb_funcall2(e->size, id_call, argc, argv); } else { |