mirror of https://github.com/python/cpython.git
gh-96678: Fix UB of null pointer arithmetic (GH-96782)
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit 81e36f350b
)
Co-authored-by: Matthias Görgens <matthias.goergens@gmail.com>
This commit is contained in:
parent
bc337a7766
commit
f2d7fa8839
|
@ -0,0 +1 @@
|
|||
Fix undefined behaviour in C code of null pointer arithmetic.
|
|
@ -1542,7 +1542,7 @@ tok_get(struct tok_state *tok, const char **p_start, const char **p_end)
|
|||
} while (c == ' ' || c == '\t' || c == '\014');
|
||||
|
||||
/* Set start of current token */
|
||||
tok->start = tok->cur - 1;
|
||||
tok->start = tok->cur == NULL ? NULL : tok->cur - 1;
|
||||
|
||||
/* Skip comment, unless it's a type comment */
|
||||
if (c == '#') {
|
||||
|
|
Loading…
Reference in New Issue