From be94808282e50d3ecaa1392ffc38c9ec89e3438b Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Fri, 10 Feb 2023 16:02:20 +0900 Subject: use correct svar even if env is escaped This patch is follo-up of 0a82bfe. Without this patch, if env is escaped (Proc'ed), strange svar can be touched. This patch tracks escaped env and use it. --- proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'proc.c') diff --git a/proc.c b/proc.c index 3e2d8be6cf..3d26fa9623 100644 --- a/proc.c +++ b/proc.c @@ -712,7 +712,8 @@ rb_vm_ifunc_new(rb_block_call_func_t func, const void *data, int min_argc, int m } arity.argc.min = min_argc; arity.argc.max = max_argc; - VALUE ret = rb_imemo_new(imemo_ifunc, (VALUE)func, (VALUE)data, arity.packed, (VALUE)GET_EC()->cfp); + rb_execution_context_t *ec = GET_EC(); + VALUE ret = rb_imemo_new(imemo_ifunc, (VALUE)func, (VALUE)data, arity.packed, (VALUE)rb_vm_svar_lep(ec, ec->cfp)); return (struct vm_ifunc *)ret; } -- cgit v1.2.1