[3.6] bpo-31852: Fix segfault caused by using the async soft keyword#4122
Merged
vstinner merged 4 commits intopython:3.6from Oct 31, 2017
Merged
[3.6] bpo-31852: Fix segfault caused by using the async soft keyword#4122vstinner merged 4 commits intopython:3.6from
vstinner merged 4 commits intopython:3.6from
Conversation
vstinner
reviewed
Oct 26, 2017
| /* Line continuation */ | ||
| if (c == '\\') { | ||
| c = tok_nextc(tok); | ||
| if ( tok->async_def == 2){ |
Member
There was a problem hiding this comment.
Coding style, please write: "if (...) {" (fix spacing)
Member
Author
|
Should I add a NEWS entry? |
Member
|
Yes, please add a NEWS entry. You should use the blurb tool.
|
Member
Author
|
Added in e5b1993 |
Member
Author
|
@Haypo There is anything more I should change? |
Member
|
@1st1: Would you mind to review this PR please? |
1st1
approved these changes
Oct 30, 2017
Member
1st1
left a comment
There was a problem hiding this comment.
I think this is an OK fix. Let's merge it.
Member
|
Thank you @pablogsal! I merged your PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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