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 | |
parent | f25daa254146c782ca50e6fc707f8f132e896e93 (diff) |
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
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | enumerator.c | 5 |
2 files changed, 8 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Tue Aug 27 16:51:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * enumerator.c (enumerator_each): ensure argument array size is int. + Tue Aug 27 16:46:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> * array.c (rb_ary_index, rb_ary_rindex): use optimized equality to 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 { |