Author: schittir Date: 2025-02-13T21:14:36-08:00 New Revision: 8a0914c24530c98c5ff65bce3710552ce3ebf7d7
URL: https://github.com/llvm/llvm-project/commit/8a0914c24530c98c5ff65bce3710552ce3ebf7d7 DIFF: https://github.com/llvm/llvm-project/commit/8a0914c24530c98c5ff65bce3710552ce3ebf7d7.diff LOG: [clang][NFC] Avoid potential null dereferences (#127017) Add null checking. Added: Modified: clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index b679d63874b3b..9f7db25a15bec 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -7447,7 +7447,7 @@ class MappableExprsHandler { // Update info about the lowest and highest elements for this struct if (!PartialStruct.Base.isValid()) { PartialStruct.LowestElem = {FieldIndex, LowestElem}; - if (IsFinalArraySection) { + if (IsFinalArraySection && OASE) { Address HB = CGF.EmitArraySectionExpr(OASE, /*IsLowerBound=*/false) .getAddress(); @@ -7460,7 +7460,7 @@ class MappableExprsHandler { } else if (FieldIndex < PartialStruct.LowestElem.first) { PartialStruct.LowestElem = {FieldIndex, LowestElem}; } else if (FieldIndex > PartialStruct.HighestElem.first) { - if (IsFinalArraySection) { + if (IsFinalArraySection && OASE) { Address HB = CGF.EmitArraySectionExpr(OASE, /*IsLowerBound=*/false) .getAddress(); diff --git a/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp index 12bf12a0b2322..8955cb209c399 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp @@ -314,6 +314,7 @@ void MacOSKeychainAPIChecker::checkPreStmt(const CallExpr *CE, RegionArgIsBad = true; } + assert(ArgSM); // Is the argument to the call being tracked? const AllocationState *AS = State->get<AllocatedData>(ArgSM); if (!AS) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits