Project

General

Profile

Actions

Bug #11012

closed

`local_variable_get` crashes on a `Proc` from a method

Added by nobu (Nobuyoshi Nakada) about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Target version:
-
[ruby-core:<unknown>]

Description

The following code shows unexpected random object, or segfaults sometimes.

class << (obj = Object.new)
  src = 1000.times.map {|i|"v#{i} = "}.join("")
  eval("def foo()\n""#{src}nil\n""end")
end

b = obj.method(:foo).to_proc.binding
p b.local_variable_get("v999")
Actions #1

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r50111.


proc.c: replicate method env

  • proc.c (proc_binding): replicate env from method object, and
    allocate the local variable area for the iseq local table.
    [ruby-core:68673] [Bug #11012]
Actions #2

Updated by nagachika (Tomoyuki Chikanaga) almost 9 years ago

  • Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE

r49922, r50111 and r50112 (r49922 for resolv conflict) were backported into ruby_2_2 branch at r50548.

Actions

Also available in: Atom PDF

Like0
Like0Like0