mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[3.12] gh-107450: Check for overflow in the tokenizer and fix overflow test (GH-110832) (#110931)
(cherry picked from commit a1ac5590e0
)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
b8e5b1b28a
commit
3b87e520fc
4 changed files with 40 additions and 29 deletions
|
@ -1366,6 +1366,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