-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
[3.6] bpo-31852: Fix segfault caused by using the async soft keyword #4122
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
Conversation
Parser/tokenizer.c
Outdated
| /* Line continuation */ | ||
| if (c == '\\') { | ||
| c = tok_nextc(tok); | ||
| if ( tok->async_def == 2){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coding style, please write: "if (...) {" (fix spacing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 7518077
|
Should I add a NEWS entry? |
|
Yes, please add a NEWS entry. You should use the blurb tool.
|
|
Added in e5b1993 |
|
@Haypo There is anything more I should change? |
|
@1st1: Would you mind to review this PR please? |
1st1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an OK fix. Let's merge it.
|
Thank you @pablogsal! I merged your PR. |
This PR solves a segmentation fault in Python 3.6 caused by a combination of the async soft keyword and continuation lines. Steps to reproduce:
As @Haypo mentioned in the issue you can use this file to use the issue in the tokenizer to induce a buffer overflow. This PR solves this issue as well.
The current implementation checks if the current token is
ASYNCand sets a sentient value (2) in thetok->async_defbefore looking for the token ahead (which is the step where the segfault happens). The value oftok->async_defgets overwritten after the lookahead by the usual value (1). As this particular issues are fixed by #1669 in the current master (3.7) this PR acts as a mere patch.https://bugs.python.org/issue31852