fix daca insighttoolkit crash in template simplifier (#2826)

Don't count deleted instantiations in the recursive count.
I can't reduce the daca code because creduce requires a preprocessed
file to reduce and the problem doesn't show up when the file is
preprocessed with cppcheck.
There is no test because I couldn't reduce the problem files.

Co-authored-by: Robert Reif <reif@FX6840>
This commit is contained in:
IOBYTE 2020-09-28 16:51:13 -04:00 committed by GitHub
parent bf236e91d7
commit 4e4108dc8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -2937,6 +2937,9 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
bool instantiated = false; bool instantiated = false;
for (const TokenAndName &instantiation : mTemplateInstantiations) { for (const TokenAndName &instantiation : mTemplateInstantiations) {
// skip deleted instantiations
if (!instantiation.token())
continue;
if (numberOfTemplateInstantiations != mTemplateInstantiations.size()) { if (numberOfTemplateInstantiations != mTemplateInstantiations.size()) {
numberOfTemplateInstantiations = mTemplateInstantiations.size(); numberOfTemplateInstantiations = mTemplateInstantiations.size();
++recursiveCount; ++recursiveCount;