-
-
Notifications
You must be signed in to change notification settings - Fork 32k
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 <pablogsal@gmail.com>
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? 😎
< 8000 details-menu class="dropdown-menu dropdown-menu-sw show-more-popover color-fg-default" style="width:185px" src="" preload >
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 <pablogsal@gmail.com> * nitty nit Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 36fcde6) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
…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 <pablogsal@gmail.com> * nitty nit Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 36fcde6) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
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 <pablogsal@gmail.com> * nitty nit Co-authored-by: Łukasz Langa <lukasz@langa.pl>. (cherry picked from commit 36fcde6) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Closes: #94360