[llvm-commits] [llvm] r84916 - /llvm/trunk/lib/CodeGen/StackProtector.cpp

Bill Wendling isanbard at gmail.com
Thu Oct 22 17:01:05 PDT 2009


Author: void
Date: Thu Oct 22 19:01:05 2009
New Revision: 84916

URL: http://llvm.org/viewvc/llvm-project?rev=84916&view=rev
Log:
Neuter stack protectors by only checking character arrays. This is what GCC
does.

Modified:
    llvm/trunk/lib/CodeGen/StackProtector.cpp

Modified: llvm/trunk/lib/CodeGen/StackProtector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=84916&r1=84915&r2=84916&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/StackProtector.cpp (original)
+++ llvm/trunk/lib/CodeGen/StackProtector.cpp Thu Oct 22 19:01:05 2009
@@ -111,11 +111,16 @@
           // protectors.
           return true;
 
-        if (const ArrayType *AT = dyn_cast<ArrayType>(AI->getAllocatedType()))
+        if (const ArrayType *AT = dyn_cast<ArrayType>(AI->getAllocatedType())) {
+          // We apparently only care about character arrays.
+          if (AT->getElementType() != Type::getInt8Ty(AT->getContext()))
+            continue;
+
           // If an array has more than SSPBufferSize bytes of allocated space,
           // then we emit stack protectors.
           if (SSPBufferSize <= TD->getTypeAllocSize(AT))
             return true;
+        }
       }
   }
 





More information about the llvm-commits mailing list