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
|
@ -0,0 +1,2 @@
|
|||
Fix invalid memory read in the new parser when checking newlines in string
|
||||
literals. Patch by Pablo Galindo.
|
|
@ -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…
Reference in New Issue