commit | 3e26e42c905852394fa136f1cc564dac98b56166 | [log] [tgz] |
---|---|---|
author | Zackery Spytz <zspytz@gmail.com> | Mon Aug 20 21:11:40 2018 -0600 |
committer | Benjamin Peterson <benjamin@python.org> | Mon Aug 20 20:11:40 2018 -0700 |
tree | aab8651b7351b994e334daf42d0b102689a6d8d7 | |
parent | cdbf50cba1664f72ae6621a89c324a32fea70377 [diff] |
bpo-34400: Fix more undefined behavior in parsetok.c (GH-8833)
diff --git a/Parser/parsetok.c b/Parser/parsetok.c index b9c9fe8..a1580e6 100644 --- a/Parser/parsetok.c +++ b/Parser/parsetok.c
@@ -252,11 +252,13 @@ } } #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,