mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (eval): fix to check stack overflow.
* eval_intern.h, vm.h: move CHECK_STACK_OVERFLOW() macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
94331261e9
commit
67aa07f44d
4 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Wed Sep 26 19:36:26 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* eval.c (eval): fix to check stack overflow.
|
||||||
|
|
||||||
|
* eval_intern.h, vm.h: move CHECK_STACK_OVERFLOW() macro.
|
||||||
|
|
||||||
Wed Sep 26 19:27:11 2007 Koichi Sasada <ko1@atdot.net>
|
Wed Sep 26 19:27:11 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* insnhelper.ci (vm_throw): fix to move increment point.
|
* insnhelper.ci (vm_throw): fix to move increment point.
|
||||||
|
|
1
eval.c
1
eval.c
|
@ -1735,6 +1735,7 @@ eval(VALUE self, VALUE src, VALUE scope, const char *file, int line)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* kick */
|
/* kick */
|
||||||
|
CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max);
|
||||||
result = vm_eval_body(th);
|
result = vm_eval_body(th);
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
|
|
|
@ -186,6 +186,12 @@ char *strrchr _((const char *, const char));
|
||||||
ruby_cref()->nd_visi = (f); \
|
ruby_cref()->nd_visi = (f); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CHECK_STACK_OVERFLOW(cfp, margin) do \
|
||||||
|
if (((VALUE *)(cfp)->sp) + (margin) >= ((VALUE *)cfp)) { \
|
||||||
|
rb_exc_raise(sysstack_error); \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
void rb_thread_cleanup _((void));
|
void rb_thread_cleanup _((void));
|
||||||
void rb_thread_wait_other_threads _((void));
|
void rb_thread_wait_other_threads _((void));
|
||||||
|
|
||||||
|
|
6
vm.h
6
vm.h
|
@ -214,12 +214,6 @@ default: \
|
||||||
((rb_control_frame_t *)(th->stack + th->stack_size) - (rb_control_frame_t *)(cfp))
|
((rb_control_frame_t *)(th->stack + th->stack_size) - (rb_control_frame_t *)(cfp))
|
||||||
#define VM_SP_CNT(th, sp) ((sp) - (th)->stack)
|
#define VM_SP_CNT(th, sp) ((sp) - (th)->stack)
|
||||||
|
|
||||||
#define CHECK_STACK_OVERFLOW(cfp, margin) do \
|
|
||||||
if (((VALUE *)(cfp)->sp) + (margin) >= ((VALUE *)cfp)) { \
|
|
||||||
rb_exc_raise(sysstack_error); \
|
|
||||||
} \
|
|
||||||
while (0)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
env{
|
env{
|
||||||
env[0] // special (block or prev env)
|
env[0] // special (block or prev env)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue