Skip to content

Fix #13654 FP containerOutOfBounds for array size given as product#7332

Merged
chrchr-github merged 2 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_13654
Feb 27, 2025
Merged

Fix #13654 FP containerOutOfBounds for array size given as product#7332
chrchr-github merged 2 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_13654

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread lib/valueflow.cpp
if (dim.known) {
size = dim.num;
} else if (dim.tok && dim.tok->hasKnownIntValue()) {
} else if (dim.tok && dim.tok->hasKnownIntValue() && dim.tok->strAt(1) == ">") {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are only two containers with <size templateParameter= in our library, std::array and std::bitset. The size parameter comes last for both of them.

@chrchr-github chrchr-github merged commit 2444687 into cppcheck-opensource:main Feb 27, 2025
@chrchr-github chrchr-github deleted the chr_13654 branch February 27, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant