Skip to content

Commit ea8ec95

Browse files
authored
gh-132769: Refactor possible read-out-of-bounds in lexer.c (#132770)
1 parent 8516343 commit ea8ec95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Parser/lexer/lexer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ set_fstring_expr(struct tok_state* tok, struct token *token, char c) {
140140
for (i = 0, j = 0; i < input_length; i++) {
141141
if (tok_mode->last_expr_buffer[i] == '#') {
142142
// Skip characters until newline or end of string
143-
while (tok_mode->last_expr_buffer[i] != '\0' && i < input_length) {
143+
while (i < input_length && tok_mode->last_expr_buffer[i] != '\0') {
144144
if (tok_mode->last_expr_buffer[i] == '\n') {
145145
result[j++] = tok_mode->last_expr_buffer[i];
146146
break;

0 commit comments

Comments
 (0)