Project

General

Profile

Actions

Bug #11594

closed

A Proc call may corrupt a local variable

Added by mame (Yusuke Endoh) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-10-15 master 52128) [x86_64-linux]
[ruby-core:71088]

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 calls rb_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


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #11596: Getting [BUG] rb_vm_get_cref: unreachableClosedko1 (Koichi Sasada)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0