Project

General

Profile

Bug #10877

String#sub causes segfault

Added by tonytonyjan (Wei-Hang Jian) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:68209]

Description

str = 'abc'
reg = /(?<foo>a)bc/
str =~ reg
$~['foo'].sub 'a', ''
$~['foo']
tmp.rb:5: [BUG] Segmentation fault at 0x00000000000020

Abort trap: 6

Files

bug-10877.log (3.92 KB) bug-10877.log nobu (Nobuyoshi Nakada), 02/21/2015 10:51 AM

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

  • File bug-10877.log bug-10877.log added
  • Description updated (diff)
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED

Shorter code:

"a".sub("a", "")
$~["foo"]
#2

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

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

Applied in changeset r49675.


re.c: RMatch::regexp can be nil

  • re.c (match_aref): RMatch::regexp is Qnil after matching by a string since r45451. [ruby-core:68209] [Bug #10877]

Updated by naruse (Yui NARUSE) over 5 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

ruby_2_2 r49690 merged revision(s) 49675.

Also available in: Atom PDF