From 4e4108dc8bdd401b39c2f03c28463ecf53771066 Mon Sep 17 00:00:00 2001 From: IOBYTE Date: Mon, 28 Sep 2020 16:51:13 -0400 Subject: [PATCH] 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 --- lib/templatesimplifier.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index f87f94114..0f1e8c809 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -2937,6 +2937,9 @@ bool TemplateSimplifier::simplifyTemplateInstantiations( bool instantiated = false; for (const TokenAndName &instantiation : mTemplateInstantiations) { + // skip deleted instantiations + if (!instantiation.token()) + continue; if (numberOfTemplateInstantiations != mTemplateInstantiations.size()) { numberOfTemplateInstantiations = mTemplateInstantiations.size(); ++recursiveCount;