summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-08 15:10:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-08 15:10:37 +0000
commit8d644d6a6e578bab91c6b0029b492673090751d4 (patch)
tree483a1243a755cf903b9a439284a6fbb84eb33158 /enumerator.c
parenta25d02b144c9560dc3d1139a4a0024b6ade6e21c (diff)
enumerator.c: fix non-single argument
* enumerator.c (lazy_zip_func): fix non-single argument. fix out-of-bound access and pack multiple yielded values. [ruby-core:56383] [Bug #8735] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/enumerator.c b/enumerator.c
index df73aef..2a73d6a 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -1700,7 +1700,12 @@ lazy_zip_func(VALUE val, VALUE zip_args, int argc, VALUE *argv)
}
ary = rb_ary_new2(RARRAY_LEN(arg) + 1);
- rb_ary_push(ary, argv[1]);
+ v = Qnil;
+ if (--argc > 0) {
+ ++argv;
+ v = argc > 1 ? rb_ary_new_from_values(argc, argv) : *argv;
+ }
+ rb_ary_push(ary, v);
for (i = 0; i < RARRAY_LEN(arg); i++) {
v = rb_rescue2(call_next, RARRAY_AREF(arg, i), next_stopped, 0,
rb_eStopIteration, (VALUE)0);