mirror of https://github.com/python/cpython
gh-96678: Fix UB of null pointer arithmetic (GH-96782)
Automerge-Triggered-By: GH:pablogsal
This commit is contained in:
parent
6ba686d97f
commit
81e36f350b
|
@ -0,0 +1 @@
|
||||||
|
Fix undefined behaviour in C code of null pointer arithmetic.
|
|
@ -1533,7 +1533,7 @@ tok_get(struct tok_state *tok, const char **p_start, const char **p_end)
|
||||||
} while (c == ' ' || c == '\t' || c == '\014');
|
} while (c == ' ' || c == '\t' || c == '\014');
|
||||||
|
|
||||||
/* Set start of current token */
|
/* 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 */
|
/* Skip comment, unless it's a type comment */
|
||||||
if (c == '#') {
|
if (c == '#') {
|
||||||
|
|
Loading…
Reference in New Issue