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

Fix null dereference in using for directive when operator name is empty #14135

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

matheusaaguiar
Copy link
Collaborator

fix #14016 .

@matheusaaguiar matheusaaguiar changed the title Fix null derefence in using for directive when operator name is empty Fix null dereference in using for directive when operator name is empty Apr 17, 2023
@matheusaaguiar matheusaaguiar force-pushed the fix_null_deref_using_for branch 2 times, most recently from facbc74 to 9cf6479 Compare April 17, 2023 19:28
@matheusaaguiar matheusaaguiar self-assigned this Apr 17, 2023
libsolidity/parsing/Parser.cpp Outdated Show resolved Hide resolved
libsolidity/parsing/Parser.cpp Outdated Show resolved Hide resolved
@@ -0,0 +1,3 @@
using {f as ''} for uint;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd cover additional cases that Kamil mentioned in the original issue. Also, this error kinda looks a bit weird when an empty string is returned; perhaps we should consider a special case for this scenario (not necessarily in this PR, since I'd assume that a segfault takes precedence).

Copy link
Collaborator Author

@matheusaaguiar matheusaaguiar Apr 17, 2023

Choose a reason for hiding this comment

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

Yes, I will add tests for those too.
I had the thought to make a different message for the case of the empty string, but stopped myself until we decide it is really needed. Also, I agree that it is probably better to (eventually) do it in another PR.

nikola-matic
nikola-matic previously approved these changes Apr 18, 2023
Copy link
Collaborator

@nikola-matic nikola-matic left a comment

Choose a reason for hiding this comment

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

@cameel for final review.

@matheusaaguiar
Copy link
Collaborator Author

Addressed all comments and rebased.

@ekpyron ekpyron merged commit 29baf3b into develop Apr 18, 2023
@ekpyron ekpyron deleted the fix_null_deref_using_for branch April 18, 2023 18:31
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.

[Parser] Null pointer deref while parsing using for directive that contains an empty string as operator name
4 participants