Actions
Bug #22603
closedparse.y off-by-one (len < MAX_WORD_LENGTH) fails to skip __ENCODING__ in regexp named-capture local assignment
Bug #22603:
parse.y off-by-one (len < MAX_WORD_LENGTH) fails to skip __ENCODING__ in regexp named-capture local assignment
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-11-18T15:35:00Z HEAD 4414d3ea25) +PRISM [aarch64-linux]
Description
$ ruby --parser=parse.y -e '/(?<__ENCODING__>a)/ =~ "a"; p [__ENCODING__, binding.local_variable_get(:__ENCODING__)]'
[#<Encoding:UTF-8>, "a"]
$ ruby -v
ruby 4.1.0dev (2026-11-18T15:35:00Z HEAD 4414d3ea25) +PRISM [aarch64-linux]
https://github.com/ruby/ruby/blob/353c293c1b1171916bd7c82f73751b01f2fb4cb4/parse.y#L15581 the comparison with MAX_WORD_LENGTH should be <=?
Actions