mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-107450: Check for overflow in the tokenizer and fix overflow test (#110832)
Co-authored-by: Filipe Laíns <lains@riseup.net> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
b3c9faf056
commit
a1ac5590e0
4 changed files with 40 additions and 22 deletions
|
@ -59,6 +59,10 @@ tok_nextc(struct tok_state *tok)
|
|||
int rc;
|
||||
for (;;) {
|
||||
if (tok->cur != tok->inp) {
|
||||
if ((unsigned int) tok->col_offset >= (unsigned int) INT_MAX) {
|
||||
tok->done = E_COLUMNOVERFLOW;
|
||||
return EOF;
|
||||
}
|
||||
tok->col_offset++;
|
||||
return Py_CHARMASK(*tok->cur++); /* Fast path */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue