[clang] [Clang][NFC] Fix potential null dereference in encodeTypeForFunctionP… (PR #104737)

via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 18 21:17:28 PDT 2024


https://github.com/smanna12 created https://github.com/llvm/llvm-project/pull/104737

…ointerAuth

>From 3de26382c5915e77d7912ed2a78988360a92a338 Mon Sep 17 00:00:00 2001
From: "Manna, Soumi" <soumi.manna at intel.com>
Date: Sun, 18 Aug 2024 21:16:47 -0700
Subject: [PATCH] [Clang][NFC] Fix potential null dereference in
 encodeTypeForFunctionPointerAuth

---
 clang/lib/AST/ASTContext.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index f35a025fc8edfc..b201d201e1ea6a 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -3279,7 +3279,7 @@ static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx,
 
   case Type::MemberPointer: {
     OS << "M";
-    const auto *MPT = T->getAs<MemberPointerType>();
+    const auto *MPT = T->castAs<MemberPointerType>();
     encodeTypeForFunctionPointerAuth(Ctx, OS, QualType(MPT->getClass(), 0));
     encodeTypeForFunctionPointerAuth(Ctx, OS, MPT->getPointeeType());
     return;



More information about the cfe-commits mailing list