Use String#undump instead of eval - #333
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Racc’s grammar file lexer (GrammarFileParser#yylex0) to avoid eval when parsing quoted string literals, aiming to reduce code execution risk by using String#undump instead.
Changes:
- Replaces
eval(scan_quoted(...))withString#undumpfor string-literal parsing. - Adds a conversion step intended to make single-quoted literals compatible with
undump.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Grammar files that use raw non-ASCII characters in double-quoted string tokens (e.g. "あ") now raise undump decodes |
String#undump is enough to parse a string literal.
|
Good point. I didn't notice it.
|
String#undumpis enough to parse a string literal.