aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-08 20:18:15 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-08 20:18:15 +0000
commit4af44129dd99a233087b5cdd60bbf2fd0b9553d4 (patch)
treebc1bfbdaff66f32f5040a5470eb7c83014625292
parentb31ac22ed75e6b0095f92f32bc5592a61211846b (diff)
Fix buffer overrun when laying out synthesized ivars.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68634 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTContext.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 307c0e4454..d056ed4cb7 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -679,7 +679,8 @@ ASTContext::getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) {
// 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);