Project

General

Profile

Actions

Bug #19339

closed

Defining ivar on special constants with @ syntax causes segv

Added by luke-gru (Luke Gruber) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:111811]

Description

1.instance_eval do
  @a = 1
end

There's a missing check at the top of vm_setivar_fastpath, should be:

    if (UNLIKELY(RB_SPECIAL_CONST_P(obj))) { // example code: 1.instance_eval { @a = 1 }
        rb_check_frozen(obj); // raise FrozenError, because it's always frozen
        return Qundef;
    }
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0