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

Fix #10526 FP: negativeIndex if function call is made after index check #4052

Merged
merged 4 commits into from
Apr 27, 2022

Conversation

chrchr-github
Copy link
Collaborator

No description provided.

@@ -2253,10 +2253,14 @@ struct ValueFlowAnalyzer : Analyzer {
} else if (getSettings()->library.getFunction(tok)) {
// Assume library function doesn't modify user-global variables
return Action::None;
// Function cast does not modify global variables
} else if (Token::simpleMatch(tok->astParent(), ".") && tok->astParent()->astOperand1() && tok->astParent()->astOperand1()->variable() &&
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't do tok->astParent()->astOperand1()->variable() as containers can be arbitrary expressions. Can you just do astIsContainer(tok->astParent()->astOperand1())?

@orbitcowboy orbitcowboy merged commit bcbc29a into danmar:main Apr 27, 2022
@chrchr-github chrchr-github deleted the chr_Fix10526 branch October 22, 2022 09:47
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.

3 participants