mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
bpo-40880: Fix invalid read in newline_in_string in pegen.c (#20666)
* bpo-40880: Fix invalid read in newline_in_string in pegen.c * Update Parser/pegen/pegen.c Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> * Add NEWS entry Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
parent
a54096e305
commit
2e6593db00
2 changed files with 4 additions and 2 deletions
|
@ -937,8 +937,8 @@ _PyPegen_number_token(Parser *p)
|
|||
static int // bool
|
||||
newline_in_string(Parser *p, const char *cur)
|
||||
{
|
||||
for (char c = *cur; cur >= p->tok->buf; c = *--cur) {
|
||||
if (c == '\'' || c == '"') {
|
||||
for (const char *c = cur; c >= p->tok->buf; c--) {
|
||||
if (*c == '\'' || *c == '"') {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue