[clang-tools-extra] r231421 - Use std::string instead of StringRef to prevent use-after-free.

Daniel Jasper djasper at google.com
Thu Mar 5 15:17:32 PST 2015


Author: djasper
Date: Thu Mar  5 17:17:32 2015
New Revision: 231421

URL: http://llvm.org/viewvc/llvm-project?rev=231421&view=rev
Log:
Use std::string instead of StringRef to prevent use-after-free.

Discovered by asan.

Modified:
    clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp?rev=231421&r1=231420&r2=231421&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp Thu Mar  5 17:17:32 2015
@@ -83,7 +83,7 @@ void NamespaceCommentCheck::check(const
   bool NeedLineBreak = NextTokenIsOnSameLine && Tok.isNot(tok::eof);
 
   SourceRange OldCommentRange(AfterRBrace, AfterRBrace);
-  StringRef Message = "%0 not terminated with a closing comment";
+  std::string Message = "%0 not terminated with a closing comment";
 
   // Try to find existing namespace closing comment on the same line.
   if (Tok.is(tok::comment) && NextTokenIsOnSameLine) {





More information about the cfe-commits mailing list