mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-132769: Refactor possible read-out-of-bounds in lexer.c
(#132770)
This commit is contained in:
parent
8516343d3a
commit
ea8ec95cfa
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue