Actions
Bug #20990
closedRipper.tokenize splits `"\C-\あ"` into tokens with invalid byte sequence
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +MN [arm64-darwin22]
Description
IRB crashes when a code is tokenized to an invalid byte sequence.
Ripper.tokenize '"\C-\あ"'
#=> ["\"", "\\C-\\\xE3\x81", "\x82", "\""]
I think the error evaluating "\C-\あ"
should be Invalid escape character syntax
just like "\C-あ"
$ ./ruby --parser=parse.y -e '"\C-あ"'
-e:1: Invalid escape character syntax
"\C-あ"
$ ./ruby --parser=parse.y -e '"\C-\あ"'
-e:1: invalid multibyte char (UTF-8)
-e:1: invalid multibyte char (UTF-8)
./ruby: compile error (SyntaxError)
Updated by tompng (tomoya ishida) 6 days ago
Pull request: https://github.com/ruby/ruby/pull/12484
Updated by nobu (Nobuyoshi Nakada) 6 days ago
- Status changed from Open to Closed
Applied in changeset git|e4ec2128ae9c5c2a43cd599759f19db21fc0238f.
[Bug #20990] Reject escaped multibyte char with control/meta prefix
Actions
Like0
Like0Like0