summaryrefslogtreecommitdiffstats
path: root/Parser/string_parser.c
diff options
context:
space:
mode:
authorEric V. Smith <ericvsmith@users.noreply.github.com>2022-06-01 23:20:06 (GMT)
committerGitHub <noreply@github.com>2022-06-01 23:20:06 (GMT)
commitee70c70aa93d7a41cbe47a0b361b17f9d7ec8acd (patch)
tree330dae5f678fbfde901a60729fe3d66813d94727 /Parser/string_parser.c
parent8a221a853787c18d5acaf46f5c449d28339cde21 (diff)
downloadcpython-ee70c70aa93d7a41cbe47a0b361b17f9d7ec8acd.zip
cpython-ee70c70aa93d7a41cbe47a0b361b17f9d7ec8acd.tar.gz
cpython-ee70c70aa93d7a41cbe47a0b361b17f9d7ec8acd.tar.bz2
gh-93418: Fix an assert when an f-string expression is followed by an '=', but no closing brace. (gh-93419)
Diffstat (limited to 'Parser/string_parser.c')
-rw-r--r--Parser/string_parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Parser/string_parser.c b/Parser/string_parser.c
index c56ed20..984c05d 100644
--- a/Parser/string_parser.c
+++ b/Parser/string_parser.c
@@ -756,7 +756,9 @@ fstring_find_expr(Parser *p, const char **str, const char *end, int raw, int rec
while (Py_ISSPACE(**str)) {
*str += 1;
}
-
+ if (*str >= end) {
+ goto unexpected_end_of_string;
+ }
/* Set *expr_text to the text of the expression. */
*expr_text = PyUnicode_FromStringAndSize(expr_start, *str-expr_start);
if (!*expr_text) {