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

parser: Syntax is trusted to have valid data #138

Closed
Kijewski opened this issue Aug 17, 2024 · 1 comment · Fixed by #141
Closed

parser: Syntax is trusted to have valid data #138

Kijewski opened this issue Aug 17, 2024 · 1 comment · Fixed by #141

Comments

@Kijewski
Copy link
Collaborator

The fields of rinja_parser::Syntax are public and Ast::from_str() trusts that the input is valid, e.g. no field contains an empty string.

If a field does contain the an empty string, then in the best case the parser panics. In the worst case it could probably deadlock, in a loop advancing the input by null bytes until you kill the process.

Should the check if the syntax is sane be moved from rinja_derive::RawSyntax into rinja_parser::Syntax?

@GuillaumeGomez
Copy link
Contributor

I think it'd be a good thing to check indeed.

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 a pull request may close this issue.

2 participants