Actions
Bug #20212
closedRegex match method is crashing - (irb):6: [BUG] Segmentation fault at 0x0000000000000000 ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin22]
Description
Tried this with ruby 3.3.0, both irb and rails console are crashing
DOMAIN_REGEX = Regexp.new(
/\A((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-zd]+[a-zd-]*[a-zd]+).((?=.*?[a-z])(?!.*--)[a-zd]+[a-zd-]*[a-zd]+)\Z/x
)
full_domain = "www.google.com"
100.times.each { full_domain.match(DOMAIN_REGEX) }
-- Ruby level backtrace information ----------------------------------------
/Users/rthilak/.rvm/gems/ruby-3.3.0@ams/bin/ruby_executable_hooks:22:in `<main>'
/Users/rthilak/.rvm/gems/ruby-3.3.0@ams/bin/ruby_executable_hooks:22:in `eval'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/bin/bundle:25:in `<main>'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/bin/bundle:25:in `load'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/exe/bundle:20:in `<top (required)>'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/exe/bundle:28:in `block in <top (required)>'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/cli.rb:28:in `start'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/cli.rb:34:in `dispatch'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/cli.rb:451:in `exec'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/cli/exec.rb:23:in `run'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `kernel_load'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `load'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/bin/irb:25:in `<top (required)>'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/bin/irb:25:in `load'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/irb.rb:903:in `start'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/irb.rb:1001:in `run'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/irb.rb:1001:in `catch'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/irb.rb:1002:in `block in run'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/irb.rb:1015:in `eval_input'
/Users/rthilak/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/irb.rb:1093:in `each_top_level_statement'
<internal:kernel>:187:in `loop'
Files
Updated by hsbt (Hiroshi SHIBATA) 10 months ago
- Status changed from Open to Assigned
- Assignee set to make_now_just (Hiroya Fujinami)
Updated by make_now_just (Hiroya Fujinami) 10 months ago
It is the exact same bug as #20207.
Updated by byroot (Jean Boussier) 10 months ago
- Related to Bug #20207: Segmentation fault for a regexp containing positive and negative lookaheads added
Updated by make_now_just (Hiroya Fujinami) 10 months ago
- Status changed from Assigned to Closed
Applied in changeset git|3e6e3ca2627b1aa71b17de902cc1b8188246a828.
Correctly handle consecutive lookarounds (#9738)
Fix [Bug #20207]
Fix [Bug #20212]
Handling consecutive lookarounds in init_cache_opcodes is buggy, so it
causes invalid memory access reported in [Bug #20207] and [Bug #20212].
This fixes it by using recursive functions to detected lookarounds
nesting correctly.
Updated by naruse (Yui NARUSE) 8 months ago
- Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: DONE
ruby_3_3 00cb72157a60c20a9b9d9fe81fc974ea83d672b4 merged revision(s) 3e6e3ca2627b1aa71b17de902cc1b8188246a828.
Actions
Like0
Like0Like0Like0Like0Like0Like0