[clang-tools-extra] r295187 - [clangd] Fix use after free.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 07:56:15 PST 2017


Author: d0k
Date: Wed Feb 15 09:56:14 2017
New Revision: 295187

URL: http://llvm.org/viewvc/llvm-project?rev=295187&view=rev
Log:
[clangd] Fix use after free.

Modified:
    clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp

Modified: clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp?rev=295187&r1=295186&r2=295187&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp (original)
+++ clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp Wed Feb 15 09:56:14 2017
@@ -95,7 +95,7 @@ void TextDocumentRangeFormattingHandler:
     return;
   }
 
-  StringRef Code = Store.getDocument(DRFP->textDocument.uri);
+  std::string Code = Store.getDocument(DRFP->textDocument.uri);
 
   size_t Begin = positionToOffset(Code, DRFP->range.start);
   size_t Len = positionToOffset(Code, DRFP->range.end) - Begin;




More information about the cfe-commits mailing list