summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristopher Aue <[email protected]>2017-08-12 23:59:35 +0200
committerChristopher Aue <[email protected]>2017-08-12 23:59:40 +0200
commitd5ac785b315530bcdba7b0a5bf9fd49f1daaaad7 (patch)
treeadce38dfcc6249d69f1ac4c43d44a35e5ae8eed3
parent198df6103924149d74f9668b5bb63c2e8e9e79ab (diff)
downloadmruby-d5ac785b315530bcdba7b0a5bf9fd49f1daaaad7.tar.gz
mruby-d5ac785b315530bcdba7b0a5bf9fd49f1daaaad7.zip
Reintroduced not storing converted proc directly in the stack
-rw-r--r--src/vm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/vm.c b/src/vm.c
index 90fa6b3b7..2df465b9d 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1345,7 +1345,10 @@ RETRY_TRY_BLOCK:
else {
blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
- blk = regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
+ /* store the converted proc not directly in the stack because the stack
+ might have been reallocated during mrb_convert_type(), see #3622 */
+ blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
+ regs[bidx] = blk;
}
}
c = mrb_class(mrb, recv);
@@ -1528,7 +1531,10 @@ RETRY_TRY_BLOCK:
recv = regs[0];
blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
- blk = regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
+ /* store the converted proc not directly in the stack because the stack
+ might have been reallocated during mrb_convert_type(), see #3622 */
+ blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
+ regs[bidx] = blk;
}
c = ci->target_class->super;
m = mrb_method_search_vm(mrb, &c, mid);