[clang] [clang][dataflow] Fix two null pointer dereferences in `getMemberForAccessor()`. (PR #66742)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 18 23:50:48 PDT 2023


================
@@ -289,11 +289,14 @@ static void insertIfFunction(const Decl &D,
 }
 
 static MemberExpr *getMemberForAccessor(const CXXMemberCallExpr &C) {
+  if (!C.getMethodDecl())
+    return nullptr;
   auto *Body = dyn_cast_or_null<CompoundStmt>(C.getMethodDecl()->getBody());
   if (!Body || Body->size() != 1)
     return nullptr;
   if (auto *RS = dyn_cast<ReturnStmt>(*Body->body_begin()))
-    return dyn_cast<MemberExpr>(RS->getRetValue()->IgnoreParenImpCasts());
+    if (RS->getRetValue() != nullptr)
----------------
martinboehme wrote:

Done, thanks!

https://github.com/llvm/llvm-project/pull/66742


More information about the cfe-commits mailing list