Actions
Bug #19750
closedRuby hangs when parsing Regexp with unterminated unicode "/\u{"
Bug #19750:
Ruby hangs when parsing Regexp with unterminated unicode "/\u{"
Description
Actions
Added by tompng (tomoya ishida) about 3 years ago. Updated about 3 years ago.
Description
According to git bisect, this is since ec3542229b29ec93062e9d90e877ea29d3c19472. @jeremyevans0 (Jeremy Evans) Could you take a look at this issue?
mame (Yusuke Endoh) wrote in #note-2:
According to git bisect, this is since ec3542229b29ec93062e9d90e877ea29d3c19472. @jeremyevans0 (Jeremy Evans) Could you take a look at this issue?
Sure, I'll take a look today.
I submitted a pull request to fix this: https://github.com/ruby/ruby/pull/8003
Applied in changeset git|1bc8838d60ef3fc6812d3b64ed87caaf0ae943d9.
Handle unterminated unicode escapes in regexps
This fixes an infinite loop possible after ec3542229b29ec93062e9d90e877ea29d3c19472.
For \u{} escapes in regexps, skip validation in the parser, and rely on the regexp
code to handle validation. This is necessary so that invalid unicode escapes in
comments in extended regexps are allowed.
Fixes [Bug #19750]
Co-authored-by: Nobuyoshi Nakada nobu@ruby-lang.org
ruby_3_2 3f6187a94797d3c4a7db00563a885e4e613b51cf merged revision(s) 1bc8838d60ef3fc6812d3b64ed87caaf0ae943d9.