8000 vm.c: check stack · Fryguy/ruby@f31307d · GitHub
[go: up one dir, main page]

Skip to content

Commit f31307d

Browse files
committed
vm.c: check stack
* vm.c (invoke_iseq_block_from_c): check stack overflow before pushing arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 67c1197 commit f31307d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,10 +992,12 @@ invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captur
992992
const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
993993
int i, opt_pc;
994994
VALUE type = is_lambda ? VM_FRAME_MAGIC_LAMBDA : VM_FRAME_MAGIC_BLOCK;
995-
VALUE *sp = th->cfp->sp;
995+
rb_control_frame_t *cfp = th->cfp;
996+
VALUE *sp = cfp->sp;
996997
const rb_callable_method_entry_t *me = th->passed_bmethod_me;
997998
th->passed_bmethod_me = NULL;
998999

1000+
CHECK_VM_STACK_OVERFLOW(cfp, argc);
9991001
for (i=0; i<argc; i++) {
10001002
sp[i] = argv[i];
10011003
}

0 commit comments

Comments
 (0)
0