Skip to content

Fix #11649 Hang in setTokenValue() on huge array#5010

Merged
orbitcowboy merged 2 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_Fix11649
Apr 25, 2023
Merged

Fix #11649 Hang in setTokenValue() on huge array#5010
orbitcowboy merged 2 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_Fix11649

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

Scanning EGM9615.h now takes less than 1 min.
This might affect code like

int f() {
	const int a[1] = {};
	//const int i[] = { 0, (3, 4), 0 }; // no warning at all
	const int i[3] = { 0, (3, 4), 0 };
	return a[i[1]];
}

but we already show an incorrect warning

bar.cpp:4:10: error: Array 'a[1]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]
 return a[i[1]];
         ^

There's also a FN constStatement.
GCC and clang detect both:
https://godbolt.org/z/Pxann8T4s

@orbitcowboy orbitcowboy merged commit 4fdcb0c into cppcheck-opensource:main Apr 25, 2023
@chrchr-github chrchr-github deleted the chr_Fix11649 branch May 22, 2023 19:02
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