[cfe-commits] r68634 - /cfe/trunk/lib/AST/ASTContext.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Apr 8 13:41:26 PDT 2009
On Apr 8, 2009, at 1:18 PM, Daniel Dunbar wrote:
> 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());
This is the upper bound and is harmless. An accurate count
is preferred though to assert more strictly in:
void SetFieldOffset(unsigned FieldNo, uint64_t Offset) {
assert (FieldNo < FieldCount && "Invalid Field No");
FieldOffsets[FieldNo] = Offset;
}
- Fariborz
>
> if (ObjCInterfaceDecl *SD = D->getSuperClass()) {
> FieldCount++;
> const ASTRecordLayout &SL = getASTObjCInterfaceLayout(SD);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list