diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2020-06-05 23:52:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-05 23:52:27 (GMT) |
commit | 2e6593db0086004a1ca7f7049218ff9573d473c2 (patch) | |
tree | 5db8bc441331b63718905d8174612bee3640c69a /Parser | |
parent | a54096e30523534e8eebb8dc1011b4536ed237a8 (diff) | |
download | cpython-2e6593db0086004a1ca7f7049218ff9573d473c2.zip cpython-2e6593db0086004a1ca7f7049218ff9573d473c2.tar.gz cpython-2e6593db0086004a1ca7f7049218ff9573d473c2.tar.bz2 |
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>
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/pegen/pegen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index c55ff7e..afe75d7 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -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; } } |