8000 vm.c: guard arguments [EXPERIMENTAL] · Fryguy/ruby@7768312 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7768312

Browse files
committed
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
1 parent 655aa31 commit 7768312

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

vm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,12 +998,14 @@ invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captur
998998
th->passed_bmethod_me = NULL;
999999

10001000
CHECK_VM_STACK_OVERFLOW(cfp, argc);
1001+
cfp->sp = sp + i;
10011002
for (i=0; i<argc; i++) {
10021003
sp[i] = argv[i];
10031004
}
10041005

10051006
opt_pc = vm_yield_setup_args(th, iseq, argc, sp, passed_block_handler,
10061007
(type == VM_FRAME_MAGIC_LAMBDA ? (splattable ? arg_setup_lambda : arg_setup_method) : arg_setup_block));
1008+
cfp->sp = sp;
10071009

10081010
if (me == NULL) {
10091011
return invoke_block(th, iseq, self, captured, cref, type, opt_pc);

vm_insnhelper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,7 +2506,11 @@ vm_callee_setup_block_arg_arg0_check(VALUE *argv)
25062506
{
25072507
VALUE ary, arg0 = argv[0];
25082508
ary = rb_check_array_type(arg0);
2509+
#if 0
25092510
argv[0] = arg0;
2511+
#else
2512+
VM_ASSERT(argv[0] == arg0);
2513+
#endif
25102514
return ary;
25112515
}
25122516

0 commit comments

Comments
 (0)
0