[clang-tools-extra] r321286 - [clangd] Fix use after free.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 21 09:51:35 PST 2017
Author: d0k
Date: Thu Dec 21 09:51:35 2017
New Revision: 321286
URL: http://llvm.org/viewvc/llvm-project?rev=321286&view=rev
Log:
[clangd] Fix use after free.
Found by asan.
Modified:
clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp
Modified: clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp?rev=321286&r1=321285&r2=321286&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp Thu Dec 21 09:51:35 2017
@@ -95,9 +95,10 @@ bool SymbolCollector::handleDeclOccurenc
return true;
auto &SM = ND->getASTContext().getSourceManager();
- SymbolLocation Location = {
- makeAbsolutePath(SM, SM.getFilename(D->getLocation())),
- SM.getFileOffset(D->getLocStart()), SM.getFileOffset(D->getLocEnd())};
+ std::string FilePath =
+ makeAbsolutePath(SM, SM.getFilename(D->getLocation()));
+ SymbolLocation Location = {FilePath, SM.getFileOffset(D->getLocStart()),
+ SM.getFileOffset(D->getLocEnd())};
std::string QName = ND->getQualifiedNameAsString();
auto ScopeAndName = splitQualifiedName(QName);
Symbols.insert({std::move(ID), ScopeAndName.second, ScopeAndName.first,
More information about the cfe-commits
mailing list