Bug #13054
closed
MatchData segfaults if RMatch::regexp is nil
Added by rhenium (Kazuki Yamaguchi) over 7 years ago.
Updated over 7 years ago.
Description
[Bug #10877] and [Bug #13042] didn't fix all of the issues.
The following four examples cause segfault for me:
"abc".sub("a", ""); $~.hash
"abc".sub("a", ""); $~.names
"abc".sub("a", ""); $~.named_captures
"abc".sub("a", ""); m=$~; m.regexp; "abc".sub("a", ""); $~ == m
- Status changed from Open to Closed
Applied in changeset r57123.
re.c: consider the case of RMatch::regexp is nil
Follow r49675, r57098 and r57110. Don't assume RMatch::regexp always
contains a valid Regexp instance; it will be Qnil if the MatchData is
created by rb_backref_set_string(). [ruby-core:78741] [Bug #13054]
- Backport changed from 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: UNKNOWN, 2.2: DONE, 2.3: REQUIRED
ruby_2_2 r57221 merged revision(s) 57123.
- Backport changed from 2.1: UNKNOWN, 2.2: DONE, 2.3: REQUIRED to 2.1: UNKNOWN, 2.2: DONE, 2.3: DONE
ruby_2_3 r57569 merged revision(s) 57123.
Also available in: Atom
PDF
Like0
Like0Like0Like0