Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize escape char in Transformer::transformSymbolicName #1645

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/parser/transformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,10 @@
if (ctx.UnescapedSymbolicName()) {
return ctx.UnescapedSymbolicName()->getText();
} else if (ctx.EscapedSymbolicName()) {
return ctx.EscapedSymbolicName()->getText();
std::string escapedSymbolName = ctx.EscapedSymbolicName()->getText();

Check warning on line 917 in src/parser/transformer.cpp

View check run for this annotation

Codecov / codecov/patch

src/parser/transformer.cpp#L917

Added line #L917 was not covered by tests
// escapedSymbolName symbol will be of form "`Some.Value`". Therefore, we need to sanitize
// it such that we don't store the symbol with escape character.
return escapedSymbolName.substr(1, escapedSymbolName.size() - 2);

Check warning on line 920 in src/parser/transformer.cpp

View check run for this annotation

Codecov / codecov/patch

src/parser/transformer.cpp#L920

Added line #L920 was not covered by tests
} else {
assert(ctx.HexLetter());
return ctx.HexLetter()->getText();
Expand Down
Loading