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
This commit is contained in:
parent
f25daa2541
commit
a5f18c1f9d
@ -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>
|
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
|
* array.c (rb_ary_index, rb_ary_rindex): use optimized equality to
|
||||||
|
@ -447,6 +447,9 @@ enumerator_each(int argc, VALUE *argv, VALUE obj)
|
|||||||
struct enumerator *e = enumerator_ptr(obj = rb_obj_dup(obj));
|
struct enumerator *e = enumerator_ptr(obj = rb_obj_dup(obj));
|
||||||
VALUE args = e->args;
|
VALUE args = e->args;
|
||||||
if (args) {
|
if (args) {
|
||||||
|
#if SIZEOF_INT < SIZEOF_LONG
|
||||||
|
rb_long2int(RARRAY_LEN(args) + argc);
|
||||||
|
#endif
|
||||||
args = rb_ary_dup(args);
|
args = rb_ary_dup(args);
|
||||||
rb_ary_cat(args, argv, argc);
|
rb_ary_cat(args, argv, argc);
|
||||||
}
|
}
|
||||||
@ -1009,7 +1012,7 @@ enumerator_size(VALUE obj)
|
|||||||
}
|
}
|
||||||
if (rb_respond_to(e->size, id_call)) {
|
if (rb_respond_to(e->size, id_call)) {
|
||||||
if (e->args) {
|
if (e->args) {
|
||||||
int argc = RARRAY_LENINT(e->args);
|
int argc = (int)RARRAY_LEN(e->args);
|
||||||
VALUE *argv = RARRAY_PTR(e->args);
|
VALUE *argv = RARRAY_PTR(e->args);
|
||||||
return rb_funcall2(e->size, id_call, argc, argv);
|
return rb_funcall2(e->size, id_call, argc, argv);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user