diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-24 08:55:17 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-24 08:55:17 +0000 |
commit | f2074245b4c4d712cb74716c680d876eda9b8789 (patch) | |
tree | a8e61723a1d797a05066dc86d5c205c77ff1e540 | |
parent | adc677eb5cd3aed1986c3316d5b98ed942f544d5 (diff) | |
download | ruby-f2074245b4c4d712cb74716c680d876eda9b8789.tar.gz |
* insns.def, vm.c: add/fix stack overflow check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | insns.def | 2 | ||||
-rw-r--r-- | vm.c | 6 |
3 files changed, 9 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Sun Jun 24 17:54:13 2007 Koichi Sasada <ko1@atdot.net> + + * insns.def, vm.c: add/fix stack overflow check. + Sun Jun 24 17:28:52 2007 Koichi Sasada <ko1@atdot.net> * insnhelper.h: change CHECK_STACK_OVERFLOW() to throw exception. @@ -1329,8 +1329,10 @@ invokeblock if (BUILTIN_TYPE(iseq) != T_NODE) { argc = caller_setup_args(th, GET_CFP(), flag, argc, 0, 0); + CHECK_STACK_OVERFLOW(GET_CFP(), iseq->stack_max); DEC_SP(argc); + argc = th_yield_setup_args(th, iseq, argc, GET_SP(), block_proc_is_lambda(block->proc)); INC_SP(argc); @@ -871,7 +871,7 @@ th_yield_setup_args(rb_thread_t *th, rb_iseq_t *iseq, VALUE ary = argv[0]; th->mark_stack_len = argc = RARRAY_LEN(ary); - /* TODO: check overflow */ + CHECK_STACK_OVERFLOW(th->cfp, argc); for (i=0; i<argc; i++) { argv[i] = RARRAY_PTR(ary)[i]; @@ -906,7 +906,6 @@ th_yield_setup_args(rb_thread_t *th, rb_iseq_t *iseq, argc, iseq->argc); } else { - /* TODO: check overflow */ for (i=argc; i<r; i++) { argv[i] = Qnil; } @@ -946,7 +945,8 @@ invoke_block(rb_thread_t *th, rb_block_t *block, VALUE self, int argc, VALUE *ar th_set_finish_env(th); - /* TODO: check overflow */ + CHECK_STACK_OVERFLOW(th->cfp, argc); + CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max); for (i=0; i<argc; i++) { th->cfp->sp[i] = argv[i]; |