Issue #13042 has been updated by Tomoyuki Chikanaga.

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 r57349 merged revision(s) 57098.

----------------------------------------
Bug #13042: gsub segfaults when the pattern is a matching string and the replacement has an unmatched named capture
https://bugs.ruby-lang.org/issues/13042#change-62507

* Author: Hordur Freyr Yngvason
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
* Backport: 2.1: UNKNOWN, 2.2: DONE, 2.3: DONE
----------------------------------------
Ruby segfaults for all code of the form

~~~ ruby
string.gsub(pattern, replacement)
~~~

where `pattern` is a substring of `string` (not a regex) and `replacement` includes a "named capture", such as `\k<>`. For example:

~~~ ruby
'hello'.gsub('hello', '\k<oops>')
~~~

---Files--------------------------------
error (5.81 KB)
test.rb (34 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>