summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-27 07:51:27 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-27 07:51:27 +0000
commita5f18c1f9d6e0917d7351c354c0f6245684cbd20 (patch)
tree3555544d58d375a900412f3202fcbbe8f1260e74 /enumerator.c
parentf25daa254146c782ca50e6fc707f8f132e896e93 (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
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/enumerator.c b/enumerator.c
index 07916e5..51c0959 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 {