https://github.com/python/cpython/commit/e140e6ef789b1d8de1afd715503740e96e5ae925 commit: e140e6ef789b1d8de1afd715503740e96e5ae925 branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: sobolevn <m...@sobolevn.me> date: 2025-04-21T22:42:55Z summary:
[3.13] gh-132769: Refactor possible read-out-of-bounds in `lexer.c` (GH-132770) (#132788) gh-132769: Refactor possible read-out-of-bounds in `lexer.c` (GH-132770) (cherry picked from commit ea8ec95cfadbf58a11ef8e41341254d982a1a479) Co-authored-by: sobolevn <m...@sobolevn.me> files: M Parser/lexer/lexer.c diff --git a/Parser/lexer/lexer.c b/Parser/lexer/lexer.c index e4b02aee51d3cf..f7e23596044109 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