[clang-tools-extra] f782d9c - [clangd] Fix use-after-free in ArgStripper

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 15 02:03:22 PDT 2020


Author: Sam McCall
Date: 2020-07-15T11:03:11+02:00
New Revision: f782d9c7002edaaf56c06a6cc1775f8f67713a29

URL: https://github.com/llvm/llvm-project/commit/f782d9c7002edaaf56c06a6cc1775f8f67713a29
DIFF: https://github.com/llvm/llvm-project/commit/f782d9c7002edaaf56c06a6cc1775f8f67713a29.diff

LOG: [clangd] Fix use-after-free in ArgStripper

Added: 
    

Modified: 
    clang-tools-extra/clangd/CompileCommands.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/CompileCommands.h b/clang-tools-extra/clangd/CompileCommands.h
index 84c4c2a26a87..3efd80026cf6 100644
--- a/clang-tools-extra/clangd/CompileCommands.h
+++ b/clang-tools-extra/clangd/CompileCommands.h
@@ -12,6 +12,7 @@
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/StringMap.h"
+#include <deque>
 #include <string>
 #include <vector>
 
@@ -92,7 +93,7 @@ class ArgStripper {
   const Rule *matchingRule(llvm::StringRef Arg, unsigned Mode,
                            unsigned &ArgCount) const;
   llvm::SmallVector<Rule, 4> Rules;
-  std::vector<std::string> Storage; // Store strings not found in option table.
+  std::deque<std::string> Storage; // Store strings not found in option table.
 };
 
 } // namespace clangd


        


More information about the cfe-commits mailing list