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 #13109 FP arrayIndexOutOfBounds with infinite loop and break in body #6986

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

chrchr-github
Copy link
Collaborator

No description provided.

@chrchr-github chrchr-github changed the title #13109 FP arrayIndexOutOfBounds with infinite loop and break in body Fix #13109 FP arrayIndexOutOfBounds with infinite loop and break in body Nov 2, 2024
lib/valueflow.cpp Outdated Show resolved Hide resolved
@pfultz2
Copy link
Contributor

pfultz2 commented Nov 8, 2024

There is also escaping functions that need to be checked for such as abort or exit, which isEscapeFunction could be used.

@chrchr-github
Copy link
Collaborator Author

There is also escaping functions that need to be checked for such as abort or exit, which isEscapeFunction could be used.

Good point, done.

@chrchr-github
Copy link
Collaborator Author

chrchr-github commented Nov 11, 2024

Do we need to check for unrelated break|continue|return in nested scopes/lambdas?
Currently we wouldn't warn for

void f() {
	const int a[10] = {};
	for (int n = 0; 1; ++n) {
		if (a[n] < 1) {
			switch (a[n]) {
				case 0:
				break;
			}
		}
	}
}

@pfultz2
Copy link
Contributor

pfultz2 commented Nov 11, 2024

Its probably something we could handle in the future.

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.

2 participants