Skip to content

Commit

Permalink
gh-96678: Fix UB of null pointer arithmetic (GH-96782)
Browse files Browse the repository at this point in the history
Automerge-Triggered-By: GH:pablogsal
  • Loading branch information
matthiasgoergens committed Sep 13, 2022
1 parent 6ba686d commit 81e36f3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
@@ -0,0 +1 @@
Fix undefined behaviour in C code of null pointer arithmetic.
2 changes: 1 addition & 1 deletion Parser/tokenizer.c
Expand Up @@ -1533,7 +1533,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 == '#') {
Expand Down

0 comments on commit 81e36f3

Please sign in to comment.