[cfe-commits] r68634 - /cfe/trunk/lib/AST/ASTContext.cpp

Daniel Dunbar daniel at zuster.org
Wed Apr 8 13:18:15 PDT 2009


Author: ddunbar
Date: Wed Apr  8 15:18:15 2009
New Revision: 68634

URL: http://llvm.org/viewvc/llvm-project?rev=68634&view=rev
Log:
Fix buffer overrun when laying out synthesized ivars.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=68634&r1=68633&r2=68634&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Apr  8 15:18:15 2009
@@ -679,7 +679,8 @@
   // Allocate and assign into ASTRecordLayouts here.  The "Entry" reference can
   // be invalidated (dangle) if the ASTRecordLayouts hashtable is inserted into.
   ASTRecordLayout *NewEntry = NULL;
-  unsigned FieldCount = D->ivar_size();
+  unsigned FieldCount = 
+    D->ivar_size() + std::distance(D->prop_begin(), D->prop_end());
   if (ObjCInterfaceDecl *SD = D->getSuperClass()) {
     FieldCount++;
     const ASTRecordLayout &SL = getASTObjCInterfaceLayout(SD);





More information about the cfe-commits mailing list