Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A4-7-1: integer data loss false positive erasing from container #793

Open
fjatWbyT opened this issue Nov 11, 2024 · 1 comment
Open

A4-7-1: integer data loss false positive erasing from container #793

fjatWbyT opened this issue Nov 11, 2024 · 1 comment
Labels
Difficulty-High A false positive or false negative report which is expected to take 1+ week effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium Standard-AUTOSAR

Comments

@fjatWbyT
Copy link
Contributor

fjatWbyT commented Nov 11, 2024

Affected rules

  • A4-7-1

Description

Decrement cannot lead to wrap-around since the container is checked for emptiness.

Example

class container
{
    bool empty()
    {
        return num_items_ == 0;
    }

    void erase()
    {
        if (empty())
            return;

        num_items_--;
    }

    std::size_t num_items_ = 0;
};
@fjatWbyT fjatWbyT added the false positive/false negative An issue related to observed false positives or false negatives. label Nov 11, 2024
@lcartey lcartey added Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address Impact-Medium labels Dec 10, 2024
@lcartey
Copy link
Collaborator

lcartey commented Dec 10, 2024

This could be addressed by adopting the CERT C implementation for this rule (as per #491), then extending support for container implementations.

@lcartey lcartey added Difficulty-High A false positive or false negative report which is expected to take 1+ week effort to address and removed Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address labels Dec 10, 2024
@lcartey lcartey moved this from Reported to Triaged in Coding Standards Public Development Board Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty-High A false positive or false negative report which is expected to take 1+ week effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium Standard-AUTOSAR
Projects
Development

No branches or pull requests

3 participants