Static analysis reveals that tok_mode->last_expr_buffer[i] != '\0' && i < input_length
is not safe
#132769
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-parser
type-bug
An unexpected behavior, bug, or error
Bug report
This code can be improved:
cpython/Parser/lexer/lexer.c
Line 143 in 132b6bc
It would be safer to first check the value of
i
and then try to access[i]
index. This way it is harder to get read out of bounds.Found by PVS-Studio in https://habr.com/ru/companies/pvs-studio/articles/902048/
Linked PRs
lexer.c
#132770lexer.c
(GH-132770) #132788The text was updated successfully, but these errors were encountered: