[cfe-commits] r100483 - /cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Ted Kremenek kremenek at apple.com
Mon Apr 5 15:39:42 PDT 2010


Author: kremenek
Date: Mon Apr  5 17:39:42 2010
New Revision: 100483

URL: http://llvm.org/viewvc/llvm-project?rev=100483&view=rev
Log:
Fix possible null dereference by bailing out of CheckObjCPropertyAttributes() early if the Decl* is null.

Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=100483&r1=100482&r2=100483&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Apr  5 17:39:42 2010
@@ -984,7 +984,10 @@
                                        unsigned &Attributes) {
   // FIXME: Improve the reported location.
   Decl *PDecl = PropertyPtrTy.getAs<Decl>();
-  ObjCPropertyDecl *PropertyDecl = dyn_cast_or_null<ObjCPropertyDecl>(PDecl);
+  if (!PDecl)
+    return;
+
+  ObjCPropertyDecl *PropertyDecl = cast<ObjCPropertyDecl>(PDecl);
   QualType PropertyTy = PropertyDecl->getType(); 
 
   // readonly and readwrite/assign/retain/copy conflict.





More information about the cfe-commits mailing list