summaryrefslogtreecommitdiffhomepage
path: root/src/vm.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-08-09 12:57:55 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-08-09 12:57:55 +0900
commit0a61df1c34c62da59bf1443d6913e99158a938a4 (patch)
tree11c42d0a39eec536aeb2f524229df467009cbb27 /src/vm.c
parent8f629578882433bf290bcff14c18dadd545ad20b (diff)
downloadmruby-0a61df1c34c62da59bf1443d6913e99158a938a4.tar.gz
mruby-0a61df1c34c62da59bf1443d6913e99158a938a4.zip
The block argument offset saved in the env was wrong; fix #3768
When the method takes variable number of argument (`argc = -1`), the block argument offset should be `-1` not `0`.
Diffstat (limited to 'src/vm.c')
-rw-r--r--src/vm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/vm.c b/src/vm.c
index 3eced7e89..970753a7c 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -289,6 +289,7 @@ mrb_env_unshare(mrb_state *mrb, struct REnv *e)
if (!e->c) {
/* save block argument position (negated) */
e->cioff = -e->cxt.c->cibase[cioff].argc-1;
+ if (e->cioff == 0) e->cioff = -1;
}
e->cxt.mid = e->cxt.c->cibase[cioff].mid;
p = (mrb_value *)mrb_malloc(mrb, sizeof(mrb_value)*len);