summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorchgnrdv <52372310+chgnrdv@users.noreply.github.com>2023-05-01 15:26:43 (GMT)
committerGitHub <noreply@github.com>2023-05-01 15:26:43 (GMT)
commitd5a97074d24cd14cb2a35a2b1ad3074863cde264 (patch)
tree799f6261799a4b4dd4c70e591c60801f6edf3023 /Parser
parent99aab610622fc4b4c4fe56b77c0760cf77066a53 (diff)
downloadcpython-d5a97074d24cd14cb2a35a2b1ad3074863cde264.zip
cpython-d5a97074d24cd14cb2a35a2b1ad3074863cde264.tar.gz
cpython-d5a97074d24cd14cb2a35a2b1ad3074863cde264.tar.bz2
gh-103824: fix use-after-free error in Parser/tokenizer.c (#103993)
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 8de0572..8fb9be7 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -2552,6 +2552,10 @@ f_string_middle:
while (end_quote_size != current_tok->f_string_quote_size) {
int c = tok_nextc(tok);
if (c == EOF || (current_tok->f_string_quote_size == 1 && c == '\n')) {
+ if (tok->decoding_erred) {
+ return MAKE_TOKEN(ERRORTOKEN);
+ }
+
assert(tok->multi_line_start != NULL);
// shift the tok_state's location into
// the start of string, and report the error