Skip to content

Commit 79f6ae0

Browse files
authored
[Clang][NFC] Fix potential null dereference in encodeTypeForFunctionPointerAuth (#104737)
This patch replaces getAs with castAs in encodeTypeForFunctionPointerAuth to prevent dereferencing a potential null pointer, enhancing type safety as reported by static analyzer tool.
1 parent 4f083c0 commit 79f6ae0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3279,7 +3279,7 @@ static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx,
32793279

32803280
case Type::MemberPointer: {
32813281
OS << "M";
3282-
const auto *MPT = T->getAs<MemberPointerType>();
3282+
const auto *MPT = T->castAs<MemberPointerType>();
32833283
encodeTypeForFunctionPointerAuth(Ctx, OS, QualType(MPT->getClass(), 0));
32843284
encodeTypeForFunctionPointerAuth(Ctx, OS, MPT->getPointeeType());
32853285
return;

0 commit comments

Comments
 (0)