mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm.c: guard arguments [EXPERIMENTAL]
* vm.c (invoke_iseq_block_from_c): guard arguments on stack, not to be clobbered during splatting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
655aa318db
commit
7768312c1d
2 changed files with 6 additions and 0 deletions
2
vm.c
2
vm.c
|
@ -998,12 +998,14 @@ invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captur
|
||||||
th->passed_bmethod_me = NULL;
|
th->passed_bmethod_me = NULL;
|
||||||
|
|
||||||
CHECK_VM_STACK_OVERFLOW(cfp, argc);
|
CHECK_VM_STACK_OVERFLOW(cfp, argc);
|
||||||
|
cfp->sp = sp + i;
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
sp[i] = argv[i];
|
sp[i] = argv[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
opt_pc = vm_yield_setup_args(th, iseq, argc, sp, passed_block_handler,
|
opt_pc = vm_yield_setup_args(th, iseq, argc, sp, passed_block_handler,
|
||||||
(type == VM_FRAME_MAGIC_LAMBDA ? (splattable ? arg_setup_lambda : arg_setup_method) : arg_setup_block));
|
(type == VM_FRAME_MAGIC_LAMBDA ? (splattable ? arg_setup_lambda : arg_setup_method) : arg_setup_block));
|
||||||
|
cfp->sp = sp;
|
||||||
|
|
||||||
if (me == NULL) {
|
if (me == NULL) {
|
||||||
return invoke_block(th, iseq, self, captured, cref, type, opt_pc);
|
return invoke_block(th, iseq, self, captured, cref, type, opt_pc);
|
||||||
|
|
|
@ -2506,7 +2506,11 @@ vm_callee_setup_block_arg_arg0_check(VALUE *argv)
|
||||||
{
|
{
|
||||||
VALUE ary, arg0 = argv[0];
|
VALUE ary, arg0 = argv[0];
|
||||||
ary = rb_check_array_type(arg0);
|
ary = rb_check_array_type(arg0);
|
||||||
|
#if 0
|
||||||
argv[0] = arg0;
|
argv[0] = arg0;
|
||||||
|
#else
|
||||||
|
VM_ASSERT(argv[0] == arg0);
|
||||||
|
#endif
|
||||||
return ary;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue