Author: d0k
Date: Fri Jun  9 12:55:42 2017
New Revision: 305094

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

Found by asan.

Modified:
    cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp?rev=305094&r1=305093&r2=305094&view=diff
==============================================================================
--- cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp Fri Jun  9 12:55:42 2017
@@ -206,7 +206,8 @@ private:
     if (isFloatingLiteral) {
       char *end;
       errno = 0;
-      double doubleValue = strtod(Result->Text.str().c_str(), &end);
+      std::string Text = Result->Text.str();
+      double doubleValue = strtod(Text.c_str(), &end);
       if (*end == 0 && errno == 0) {
         Result->Kind = TokenInfo::TK_Literal;
         Result->Value = doubleValue;


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to