[cfe-commits] r94762 - /cfe/trunk/lib/Analysis/PrintfFormatString.cpp

Ted Kremenek kremenek at apple.com
Thu Jan 28 15:56:52 PST 2010


Author: kremenek
Date: Thu Jan 28 17:56:52 2010
New Revision: 94762

URL: http://llvm.org/viewvc/llvm-project?rev=94762&view=rev
Log:
Fix off-by-one error in ParseFormatSpecifier() when reporting the location of a null character.

Modified:
    cfe/trunk/lib/Analysis/PrintfFormatString.cpp

Modified: cfe/trunk/lib/Analysis/PrintfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=94762&r1=94761&r2=94762&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Thu Jan 28 17:56:52 2010
@@ -89,16 +89,15 @@
   UpdateOnReturn <const char*> UpdateBeg(Beg, I);
 
   // Look for a '%' character that indicates the start of a format specifier.
-  while (I != E) {
+  for ( ; I != E ; ++I) {
     char c = *I;
-    ++I;    
     if (c == '\0') {
       // Detect spurious null characters, which are likely errors.
       H.HandleNullChar(I);
       return true;
     }
     if (c == '%') {
-      Start = I;  // Record the start of the format specifier.
+      Start = I++;  // Record the start of the format specifier.
       break;
     }
   }





More information about the cfe-commits mailing list