From: Zackery Spytz Date: Tue, 21 Aug 2018 03:11:40 +0000 (-0600) Subject: bpo-34400: Fix more undefined behavior in parsetok.c (GH-8833) X-Git-Tag: v3.8.0a1~1187 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3e26e42c905852394fa136f1cc564dac98b56166;p=thirdparty%2FPython%2Fcpython.git bpo-34400: Fix more undefined behavior in parsetok.c (GH-8833) --- diff --git a/Parser/parsetok.c b/Parser/parsetok.c index b9c9fe8fa8c2..a1580e6751e4 100644 --- a/Parser/parsetok.c +++ b/Parser/parsetok.c @@ -252,11 +252,13 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret, } } #endif - if (a >= tok->line_start) + if (a != NULL && a >= tok->line_start) { col_offset = Py_SAFE_DOWNCAST(a - tok->line_start, intptr_t, int); - else + } + else { col_offset = -1; + } if ((err_ret->error = PyParser_AddToken(ps, (int)type, str,