[PATCH] D152194: [NFC][CLANG] Fix nullptr dereference issue found by static analyzer tool
Soumi Manna via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 5 13:32:01 PDT 2023
Manna added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:756
if (ReceiverType->isObjCIdType() || ReceiverType->isObjCClassType() ||
ASTCtxt.canAssignObjCInterfaces(ReceiverObjectPtrType, TrackedType)) {
const ObjCInterfaceDecl *InterfaceDecl = TrackedType->getInterfaceDecl();
----------------
We are assigning: ReceiverObjectPtrType = nullptr return value from getAs.
```
const auto *ReceiverObjectPtrType =
ReceiverType->getAs<ObjCObjectPointerType>();
```
Then we are dereferencing nullptr ReceiverObjectPtrType when calling canAssignObjCInterfaces()
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152194/new/
https://reviews.llvm.org/D152194
More information about the cfe-commits
mailing list