Skip to content

Static analysis reveals that tok_mode->last_expr_buffer[i] != '\0' && i < input_length is not safe #132769

@sobolevn

Description

@sobolevn

Bug report

This code can be improved:

while (tok_mode->last_expr_buffer[i] != '\0' && i < input_length) {

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

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-parsertype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions