From 2e563c28c456b48f43f38f5a92a4bc292d5cda91 Mon Sep 17 00:00:00 2001 From: Manuel Klimek Date: Mon, 30 Sep 2013 13:29:01 +0000 Subject: [PATCH] Fix use-after-free. TemplateDeclInstantiator takes the MultiLevelArgumentList by const-ref and stores a const-ref member. Thus, we must not pass a temporary into the constructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191665 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplateInstantiateDecl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 8d384b915b..35f3616db6 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -3312,9 +3312,9 @@ VarTemplateSpecializationDecl *Sema::BuildVarTemplateInstantiation( // we want to instantiate a definition. FromVar = FromVar->getFirstDeclaration(); - TemplateDeclInstantiator Instantiator( - *this, FromVar->getDeclContext(), - MultiLevelTemplateArgumentList(TemplateArgList)); + MultiLevelTemplateArgumentList MultiLevelList(TemplateArgList); + TemplateDeclInstantiator Instantiator(*this, FromVar->getDeclContext(), + MultiLevelList); // TODO: Set LateAttrs and StartingScope ... -- 2.50.1