diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2020-10-25 23:03:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-25 23:03:41 (GMT) |
commit | e68c67805e6a4c4ec80bea64be0e8373cc02d322 (patch) | |
tree | 129821827cbba9aea627cf226d9644b086cab3d0 /Parser/pegen.c | |
parent | d1a0a960ee493262fb95a0f5b795b5b6d75cecb8 (diff) | |
download | cpython-e68c67805e6a4c4ec80bea64be0e8373cc02d322.zip cpython-e68c67805e6a4c4ec80bea64be0e8373cc02d322.tar.gz cpython-e68c67805e6a4c4ec80bea64be0e8373cc02d322.tar.bz2 |
bpo-42150: Avoid buffer overflow in the new parser (GH-22978)
Diffstat (limited to 'Parser/pegen.c')
-rw-r--r-- | Parser/pegen.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Parser/pegen.c b/Parser/pegen.c index efa5ed9..c7343f7 100644 --- a/Parser/pegen.c +++ b/Parser/pegen.c @@ -990,7 +990,8 @@ bad_single_statement(Parser *p) /* Newlines are allowed if preceded by a line continuation character or if they appear inside a string. */ - if (!cur || *(cur - 1) == '\\' || newline_in_string(p, cur)) { + if (!cur || (cur != p->tok->buf && *(cur - 1) == '\\') + || newline_in_string(p, cur)) { return 0; } char c = *cur; |