Commit 3e26e42c authored by Zackery Spytz's avatar Zackery Spytz Committed by Benjamin Peterson

bpo-34400: Fix more undefined behavior in parsetok.c (GH-8833)

parent cdbf50cb
...@@ -252,11 +252,13 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret, ...@@ -252,11 +252,13 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
} }
} }
#endif #endif
if (a >= tok->line_start) if (a != NULL && a >= tok->line_start) {
col_offset = Py_SAFE_DOWNCAST(a - tok->line_start, col_offset = Py_SAFE_DOWNCAST(a - tok->line_start,
intptr_t, int); intptr_t, int);
else }
else {
col_offset = -1; col_offset = -1;
}
if ((err_ret->error = if ((err_ret->error =
PyParser_AddToken(ps, (int)type, str, PyParser_AddToken(ps, (int)type, str,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment