Skip to content

Use String#undump instead of eval#333

Open
kou wants to merge 1 commit into
ruby:masterfrom
kou:undump
Open

Use String#undump instead of eval#333
kou wants to merge 1 commit into
ruby:masterfrom
kou:undump

Conversation

@kou

@kou kou commented Jul 10, 2026

Copy link
Copy Markdown
Member

String#undump is enough to parse a string literal.

Copilot AI review requested due to automatic review settings July 10, 2026 05:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(...)) with String#undump for 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.

Comment thread lib/racc/grammarfileparser.rb Outdated
String#undump is enough to parse a string literal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants