gh-94360: Fix a tokenizer crash when reading encoded files with syntax errors from stdin#94386
gh-94360: Fix a tokenizer crash when reading encoded files with syntax errors from stdin#94386pablogsal merged 2 commits intopython:mainfrom
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 ! |
| 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.
NULL + 1 is beautifully strongly typed, huh? 😎
|
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