Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix possible buffer overflow in the new parser when checking for
continuation lines. Patch by Pablo Galindo.
3 changes: 2 additions & 1 deletion Parser/pegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down