diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-09-13 15:03:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 15:03:51 (GMT) |
commit | d357f71f46f9a56285eb883ab9ce285647419474 (patch) | |
tree | d3cb5ce9a73da3aacfd15fc50d7704017851ee22 /Parser/tokenizer.c | |
parent | fbc768ff68bdaa3dae3e37c0006bf30a32ccbea1 (diff) | |
download | cpython-d357f71f46f9a56285eb883ab9ce285647419474.zip cpython-d357f71f46f9a56285eb883ab9ce285647419474.tar.gz cpython-d357f71f46f9a56285eb883ab9ce285647419474.tar.bz2 |
gh-96678: Fix UB of null pointer arithmetic (GH-96782)
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit 81e36f350b75d2ed2668825f7df6e059b57f859c)
Co-authored-by: Matthias Görgens <matthias.goergens@gmail.com>
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r-- | Parser/tokenizer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 2f00d20..0bbf1b1 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1530,7 +1530,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 == '#') { |