Actions
Bug #11594
closedA Proc call may corrupt a local variable
Description
x, y, z = 1, 2, 3
p [x, y, z] #=> [1, 2, 3]
-> &blk { }.call &:foo
p [x, y, z] #=> [false, 2, 3] !!! WRONG !!!
The proc call in Line 3 modifies a local variable.
git bisect showed r52056. I confirmed it worked fine when I revert the commit.
-
rb_sym_to_proc
creates a Proc instance, -
rb_sym_to_proc
callsrb_block_clear_env_self
, and -
rb_block_clear_env_self
seems to break the variable, instead of clearing self.
I guess rb_sym_to_proc
creates an inconsistent Proc, but I don't know what is happening precisely.
--
Yusuke Endoh mame@ruby-lang.org
Updated by nobu (Nobuyoshi Nakada) over 8 years ago
- Status changed from Assigned to Closed
Applied in changeset r52129.
proc.c: proc without env
- proc.c (rb_sym_to_proc): move from string.c and create a Proc
with no environments. [ruby-core:71088] [Bug #11594]
Updated by wanabe (_ wanabe) over 8 years ago
- Related to Bug #11596: Getting [BUG] rb_vm_get_cref: unreachable added
Actions
Like0
Like0Like0