-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-94360: Fix a tokenizer crash when reading encoded files with syntax errors from stdin #94386
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
I'm not adding a test (for now) because this doesn't reproduce nicely on the test suite. |
… syntax errors from stdin Signed-off-by: Pablo Galindo <[email protected]>
Confirmed that this resolves the crash as produced by my reduced reproducer in |
Thanks for checking @zware ! |
@@ -259,15 +259,15 @@ get_error_line_from_tokenizer_buffers(Parser *p, Py_ssize_t lineno) | |||
const char* buf_end = p->tok->fp_interactive ? p->tok->interactive_src_end : p->tok->inp; | |||
|
|||
for (int i = 0; i < relative_lineno - 1; i++) { | |||
char *new_line = strchr(cur_line, '\n') + 1; |
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.
NULL + 1
is beautifully strongly typed, huh? 😎
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.
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
GH-94573 is a backport of this pull request to the 3.11 branch. |
Sorry, @pablogsal, I could not cleanly backport this to |
… syntax errors from stdin (pythonGH-94386) * pythongh-94360: Fix a tokenizer crash when reading encoded files with syntax errors from stdin Signed-off-by: Pablo Galindo <[email protected]> * nitty nit Co-authored-by: Łukasz Langa <[email protected]> (cherry picked from commit 36fcde6) Co-authored-by: Pablo Galindo Salgado <[email protected]>
…x errors from stdin (GH-94386) * gh-94360: Fix a tokenizer crash when reading encoded files with syntax errors from stdin Signed-off-by: Pablo Galindo <[email protected]> * nitty nit Co-authored-by: Łukasz Langa <[email protected]> (cherry picked from commit 36fcde6) Co-authored-by: Pablo Galindo Salgado <[email protected]>
GH-94574 is a backport of this pull request to the 3.10 branch. |
…es with syntax errors from stdin (pythonGH-94386) * pythongh-94360: Fix a tokenizer crash when reading encoded files with syntax errors from stdin Signed-off-by: Pablo Galindo <[email protected]> * nitty nit Co-authored-by: Łukasz Langa <[email protected]>. (cherry picked from commit 36fcde6) Co-authored-by: Pablo Galindo Salgado <[email protected]>
…h syntax errors from stdin (GH-94386) (GH-94574) Signed-off-by: Pablo Galindo <[email protected]> Co-authored-by: Pablo Galindo Salgado <[email protected]> Co-authored-by: Łukasz Langa <[email protected]> (cherry picked from commit 36fcde6)
Closes: #94360