https://github.com/python/cpython/commit/ea8ec95cfadbf58a11ef8e41341254d982a1a479 commit: ea8ec95cfadbf58a11ef8e41341254d982a1a479 branch: main author: sobolevn <m...@sobolevn.me> committer: pablogsal <pablog...@gmail.com> date: 2025-04-21T18:48:48+01:00 summary:
gh-132769: Refactor possible read-out-of-bounds in `lexer.c` (#132770) files: M Parser/lexer/lexer.c diff --git a/Parser/lexer/lexer.c b/Parser/lexer/lexer.c index 5e68e5d035c545..e81867a5fad015 100644 --- a/Parser/lexer/lexer.c +++ b/Parser/lexer/lexer.c @@ -140,7 +140,7 @@ set_fstring_expr(struct tok_state* tok, struct token *token, char c) { for (i = 0, j = 0; i < input_length; i++) { if (tok_mode->last_expr_buffer[i] == '#') { // Skip characters until newline or end of string - while (tok_mode->last_expr_buffer[i] != '\0' && i < input_length) { + while (i < input_length && tok_mode->last_expr_buffer[i] != '\0') { if (tok_mode->last_expr_buffer[i] == '\n') { result[j++] = tok_mode->last_expr_buffer[i]; break; _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com