From f2074245b4c4d712cb74716c680d876eda9b8789 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 24 Jun 2007 08:55:17 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ insns.def | 2 ++ vm.c | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 09f2f8dc6a..75af323df6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Jun 24 17:54:13 2007 Koichi Sasada + + * insns.def, vm.c: add/fix stack overflow check. + Sun Jun 24 17:28:52 2007 Koichi Sasada * insnhelper.h: change CHECK_STACK_OVERFLOW() to throw exception. diff --git a/insns.def b/insns.def index 792c8d40f1..27b52b01f4 100644 --- a/insns.def +++ b/insns.def @@ -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); diff --git a/vm.c b/vm.c index f4e37d28a7..487797818c 100644 --- a/vm.c +++ b/vm.c @@ -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; iargc); } else { - /* TODO: check overflow */ for (i=argc; icfp, argc); + CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max); for (i=0; icfp->sp[i] = argv[i];