Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Fix use-after-free in tokenizer.c
`tok_get_fstring_mode`: ensure that token in the f-string middle is properly decoded, i.e. `tok_nextc` doesn't return EOF with `tok->decoding_erred` set to 1
  • Loading branch information
chgnrdv committed Apr 29, 2023
commit c120bc2d354ca3d27d0c7a53bf65574ddaabaf3a
3 changes: 3 additions & 0 deletions Parser/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2552,6 +2552,9 @@ tok_get_fstring_mode(struct tok_state *tok, tokenizer_mode* current_tok, struct
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);
Comment thread
pablogsal marked this conversation as resolved.
Outdated

assert(tok->multi_line_start != NULL);
// shift the tok_state's location into
// the start of string, and report the error
Expand Down