Hi clang,

Clang will crash on the following codes with "-cc1 -analyze
-analyzer-checker=core,experimental -analyzer-store region".

#include <ostream>
#include <iomanip>

using namespace std;

void oops2(ostream &os, float f)
{
  os << setprecision(2) << f;
}

This patch fix this crash in MallocOverflowSecurityChecker.

-- 
Best regards!

Lei Zhang
Index: MallocOverflowSecurityChecker.cpp
===================================================================
--- MallocOverflowSecurityChecker.cpp	(revision 140435)
+++ MallocOverflowSecurityChecker.cpp	(working copy)
@@ -245,6 +245,9 @@
           // Get the name of the callee. If it's a builtin, strip off the prefix.
           IdentifierInfo *FnInfo = FD->getIdentifier();
 
+          if (!FnInfo)
+            return;
+
           if (FnInfo->isStr ("malloc") || FnInfo->isStr ("_MALLOC")) {
             if (TheCall->getNumArgs() == 1)
               CheckMallocArgument(PossibleMallocOverflows, TheCall->getArg(0),
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to