Issue #20207 has been updated by naruse (Yui NARUSE).
Backport changed from 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED to 3.0:
DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE
ruby_3_3 00cb72157a60c20a9b9d9fe81fc974ea83d672b4 merged revision(s)
3e6e3ca2627b1aa71b17de902cc1b8188246a828.
----------------------------------------
Bug #20207: Segmentation fault for a regexp containing positive and negative lookaheads
https://bugs.ruby-lang.org/issues/20207#change-107394
* Author: Sundeep (Sundeep Agarwal)
* Status: Closed
* Assignee: make_now_just (Hiroya Fujinami)
* Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE
----------------------------------------
I'm getting segmentation fault for the following regexp with Ruby 3.3.0:
``` ruby
puts 'clan'.match?(/(?=.*a)(?!.*n)/)
```
This is the minimal example for which I was able to produce the issue. `a` and `n` in the
above example
are just a sample, can be other character combinations too. There has to be at least two
characters
before them in the input string (`cl` in the above example).
The error is seen when the above code is run from a file, but only occasionally from irb.
When run from a file, most of the time I get segmentation fault (see attached log file),
but sometimes I get the following error:
``` ruby
lookaround.rb:1:in `match?': undefined bytecode (bug): /(?=.*a)(?!.*n)/ (RegexpError)
from lookaround.rb:1:in `<main>'
```
When asked in the r/ruby forum, somebody else was able to reproduce this issue.
They also mentioned that the issue wasn't seen in the Ruby 3.2.2 version.
---Files--------------------------------
lookaround_segfault.log (15.9 KB)
--
https://bugs.ruby-lang.org/