mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm.c (vm_set_top_stack, vm_set_eval_stack): check for stack
overflow with stack_max before push new frame. [ruby-core:41520] [Bug #5720] * vm.c (vm_set_main_stack): no stack overflow chances after vm_set_eval_stack(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3a5daefe1f
commit
054dbe2a43
3 changed files with 18 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
|||
Wed Dec 7 18:55:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm.c (vm_set_top_stack, vm_set_eval_stack): check for stack
|
||||
overflow with stack_max before push new frame. [ruby-core:41520]
|
||||
[Bug #5720]
|
||||
|
||||
* vm.c (vm_set_main_stack): no stack overflow chances after
|
||||
vm_set_eval_stack().
|
||||
|
||||
Wed Dec 7 09:58:15 2011 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* ext/bigdecimal/bigdecimal.c: Document +@, -@, hash, INFINITY, Nan.
|
||||
|
|
|
@ -328,4 +328,10 @@ end.join
|
|||
def test_errno
|
||||
assert_equal(Encoding.find("locale"), Errno::EINVAL.new.message.encoding)
|
||||
end
|
||||
|
||||
def test_too_many_args_in_eval
|
||||
bug5720 = '[ruby-core:41520]'
|
||||
arg_string = (0...140000).to_a.join(", ")
|
||||
assert_raise(SystemStackError, bug5720) {eval "raise(#{arg_string})"}
|
||||
end
|
||||
end
|
||||
|
|
9
vm.c
9
vm.c
|
@ -106,11 +106,10 @@ vm_set_top_stack(rb_thread_t * th, VALUE iseqval)
|
|||
/* for return */
|
||||
rb_vm_set_finish_env(th);
|
||||
|
||||
CHECK_STACK_OVERFLOW(th->cfp, iseq->local_size + iseq->stack_max);
|
||||
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
|
||||
|
@ -122,6 +121,8 @@ vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref)
|
|||
|
||||
/* for return */
|
||||
rb_vm_set_finish_env(th);
|
||||
|
||||
CHECK_STACK_OVERFLOW(th->cfp, iseq->local_size + iseq->stack_max);
|
||||
vm_push_frame(th, iseq, VM_FRAME_MAGIC_EVAL, block->self,
|
||||
GC_GUARDED_PTR(block->dfp), iseq->iseq_encoded,
|
||||
th->cfp->sp, block->lfp, iseq->local_size);
|
||||
|
@ -129,8 +130,6 @@ 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
|
||||
|
@ -152,8 +151,6 @@ vm_set_main_stack(rb_thread_t *th, VALUE iseqval)
|
|||
if (bind && iseq->local_size > 0) {
|
||||
bind->env = rb_vm_make_env_object(th, th->cfp);
|
||||
}
|
||||
|
||||
CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max);
|
||||
}
|
||||
|
||||
rb_control_frame_t *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue