[cfe-commits] r85872 - /cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp

Ted Kremenek kremenek at apple.com
Mon Nov 2 22:18:06 PST 2009


Author: kremenek
Date: Tue Nov  3 00:18:05 2009
New Revision: 85872

URL: http://llvm.org/viewvc/llvm-project?rev=85872&view=rev
Log:
Fix buffer overflow in PrintMacroDefinition() by inverting the check to see if the target buffer needs to be resized.  Fixes <rdar://problem/7255377>.

Modified:
    cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp

Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=85872&r1=85871&r2=85872&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Tue Nov  3 00:18:05 2009
@@ -66,7 +66,7 @@
       OS << ' ';
 
     // Make sure we have enough space in the spelling buffer.
-    if (I->getLength() < SpellingBuffer.size())
+    if (I->getLength() > SpellingBuffer.size())
       SpellingBuffer.resize(I->getLength());
     const char *Buffer = SpellingBuffer.data();
     unsigned SpellingLen = PP.getSpelling(*I, Buffer);





More information about the cfe-commits mailing list