From 7d9c2a6733144e1f10678c59018f540f61d4c6c0 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 16 Oct 2001 15:17:10 +0000 Subject: * eval.c (rb_f_missing): check stack level with rb_stack_check(). * eval.c (rb_call0): ditto. * eval.c, intern.h (rb_stack_check): added. [new] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 628758a93a..bc3a4b1a37 100644 --- a/eval.c +++ b/eval.c @@ -4150,6 +4150,8 @@ rb_f_missing(argc, argv, obj) rb_raise(rb_eArgError, "no id given"); } + rb_stack_check(); + id = SYM2ID(argv[0]); switch (TYPE(obj)) { @@ -4282,6 +4284,14 @@ stack_length(p) #endif } +void +rb_stack_check() +{ + if (stack_length(0) > STACK_LEVEL_MAX) { + rb_raise(rb_eSysStackError, "stack level too deep"); + } +} + static VALUE call_cfunc(func, recv, len, argc, argv) VALUE (*func)(); @@ -4397,9 +4407,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper) if ((++tick & 0xff) == 0) { CHECK_INTS; /* better than nothing */ - if (stack_length(0) > STACK_LEVEL_MAX) { - rb_raise(rb_eSysStackError, "stack level too deep"); - } + rb_stack_check(); } PUSH_ITER(itr); PUSH_FRAME(); -- cgit v1.2.3