Skip to content

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

Closed

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

Activity

  1. added
    interpreter-core
    type-bug
    on Apr 21, 2025
  2. self-assigned this
    on Apr 21, 2025
  3. added 2 commits that reference this issue on Apr 21, 2025
  4. added a commit that references this issue on Apr 21, 2025
  5. added a commit that references this issue on Apr 21, 2025
  6. added a commit that references this issue on Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

interpreter-coretopic-parsertype-bug

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions