mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
67c1197835
commit
f31307d12d
1 changed files with 3 additions and 1 deletions
4
vm.c
4
vm.c
|
@ -992,10 +992,12 @@ invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captur
|
||||||
const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
|
const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
|
||||||
int i, opt_pc;
|
int i, opt_pc;
|
||||||
VALUE type = is_lambda ? VM_FRAME_MAGIC_LAMBDA : VM_FRAME_MAGIC_BLOCK;
|
VALUE type = is_lambda ? VM_FRAME_MAGIC_LAMBDA : VM_FRAME_MAGIC_BLOCK;
|
||||||
VALUE *sp = th->cfp->sp;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
|
VALUE *sp = cfp->sp;
|
||||||
const rb_callable_method_entry_t *me = th->passed_bmethod_me;
|
const rb_callable_method_entry_t *me = th->passed_bmethod_me;
|
||||||
th->passed_bmethod_me = NULL;
|
th->passed_bmethod_me = NULL;
|
||||||
|
|
||||||
|
CHECK_VM_STACK_OVERFLOW(cfp, argc);
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
sp[i] = argv[i];
|
sp[i] = argv[i];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue