From: Ted Kremenek Date: Mon, 5 Apr 2010 22:39:42 +0000 (+0000) Subject: Fix possible null dereference by bailing out of CheckObjCPropertyAttributes() early... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5fcd52a6c94c7f93bd80062248353c45330da23a;p=clang Fix possible null dereference by bailing out of CheckObjCPropertyAttributes() early if the Decl* is null. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100483 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 52b9bcf86c..605750408c 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -984,7 +984,10 @@ void Sema::CheckObjCPropertyAttributes(DeclPtrTy PropertyPtrTy, unsigned &Attributes) { // FIXME: Improve the reported location. Decl *PDecl = PropertyPtrTy.getAs(); - ObjCPropertyDecl *PropertyDecl = dyn_cast_or_null(PDecl); + if (!PDecl) + return; + + ObjCPropertyDecl *PropertyDecl = cast(PDecl); QualType PropertyTy = PropertyDecl->getType(); // readonly and readwrite/assign/retain/copy conflict.