1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2001-10-16 15:17:10 +00:00
parent 1c7cf852bd
commit 7d9c2a6733
3 changed files with 20 additions and 3 deletions

View file

@ -1,3 +1,11 @@
Tue Oct 16 21:38:15 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* 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]
Tue Oct 16 13:18:47 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* object.c (rb_mod_initialize): optional block with

14
eval.c
View file

@ -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();

View file

@ -112,6 +112,7 @@ EXTERN int ruby_nerrs;
VALUE rb_exc_new _((VALUE, const char*, long));
VALUE rb_exc_new2 _((VALUE, const char*));
VALUE rb_exc_new3 _((VALUE, VALUE));
void rb_stack_check _((void));
NORETURN(void rb_loaderror __((const char*, ...)));
NORETURN(void rb_name_error __((VALUE id, const char*, ...)));
void rb_compile_error __((const char*, ...));