From 7f2ef1a96e3ae57b578bbb4d996fce3ddefc81fa Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 29 Oct 2009 17:16:05 +0000 Subject: * enum.c (enum_count): call #size using rb_funcall_no_recursive() to prevent infinite recursive calls. [ruby-core:24794] * vm_eval.c (rb_funcall_no_recursive): utility function to check direct recursive call. * vm_eval.c (rb_check_funcall): move from eval.c. [refactoring] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enum.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'enum.c') diff --git a/enum.c b/enum.c index c1efb1b5c2..aa3a9b7af3 100644 --- a/enum.c +++ b/enum.c @@ -119,6 +119,8 @@ count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv) return Qnil; } +extern VALUE rb_funcall_no_recursive(VALUE, ID, int, VALUE*, VALUE (*)()); + /* * call-seq: * enum.count => int @@ -150,8 +152,8 @@ enum_count(int argc, VALUE *argv, VALUE obj) } else { VALUE tmp; - - tmp = rb_check_funcall(obj, id_size, 0, 0); + + tmp = rb_funcall_no_recursive(obj, id_size, 0, 0, enum_count); if (tmp != Qundef) return tmp; func = count_all_i; } -- cgit v1.2.3