From 272a3aa6a2ef9d2ef60288791f0e73c978367f62 Mon Sep 17 00:00:00 2001 From: ko1 Date: Mon, 29 Dec 2008 07:44:56 +0000 Subject: [PATCH] * vm.c (vm_set_eval_stack, vm_set_main_stack, vm_set_top_stack): check stack overflow. [ruby-dev:37646] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ vm.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index d37523def4..89c500182a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Dec 29 16:16:20 2008 Koichi Sasada + + * vm.c (vm_set_eval_stack, vm_set_main_stack, vm_set_top_stack): + check stack overflow. [ruby-dev:37646] + Sun Dec 28 18:36:33 2008 Yuki Sonoda (Yugui) * test/rubygems/test_gem_command.rb diff --git a/vm.c b/vm.c index ddb736c089..2469d5ea4e 100644 --- a/vm.c +++ b/vm.c @@ -77,6 +77,8 @@ vm_set_top_stack(rb_thread_t * th, VALUE iseqval) vm_push_frame(th, iseq, VM_FRAME_MAGIC_TOP, th->top_self, 0, iseq->iseq_encoded, th->cfp->sp, 0, iseq->local_size); + + CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max); } static void @@ -95,6 +97,8 @@ vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref) if (cref) { th->cfp->dfp[-1] = (VALUE)cref; } + + CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max); } static void @@ -116,6 +120,8 @@ vm_set_main_stack(rb_thread_t *th, VALUE iseqval) if (bind && iseq->local_size > 0) { bind->env = vm_make_env_object(th, th->cfp); } + + CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max); } rb_control_frame_t *