Project

General

Profile

Actions

Bug #22535

closed

Release mode segfault due to half-initialized error in singleton_method

Bug #22535: Release mode segfault due to half-initialized error in singleton_method

Added by tekknolagi (Maxwell Bernstein) 1 day ago. Updated 5 minutes ago.

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

Description

This causes a segfault seemingly only in release mode:

name = "never_interned_#{rand(10**12)}"
begin
  Object.new.singleton_method(name)
rescue NameError => e
  STDERR.puts "rescued #{e.class}; e.name.class = #{e.name.class}"
  STDERR.puts e.message          # segfaults here (rb_sym_to_s on ID2SYM(0))
end

Updated by jhawthorn (John Hawthorn) about 19 hours ago Actions #2

  • Status changed from Open to Closed

Applied in changeset git|45666487ee3868605bc6fd792f21ff8ac42264da.


Fix NameError from singleton_method for a name with no ID

rb_check_id returns 0 when the name has no ID, and we were passing that
to ID2SYM. 0 is never a valid ID, so also assert against it in
rb_id2sym.

[Bug #22535]

Updated by jhawthorn (John Hawthorn) about 19 hours ago Actions #3 [ruby-core:127428]

  • Backport changed from 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.3: DONTNEED, 3.4: REQUIRED, 4.0: REQUIRED

Updated by jhawthorn (John Hawthorn) 5 minutes ago Actions #4

  • Backport changed from 3.3: DONTNEED, 3.4: REQUIRED, 4.0: REQUIRED to 3.3: DONTNEED, 3.4: REQUIRED, 4.0: DONE
Actions

Also available in: PDF Atom