Skip to content

Commit 8a0914c

Browse files
authored
[clang][NFC] Avoid potential null dereferences (llvm#127017)
Add null checking.
1 parent 083f099 commit 8a0914c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -7447,7 +7447,7 @@ class MappableExprsHandler {
74477447
// Update info about the lowest and highest elements for this struct
74487448
if (!PartialStruct.Base.isValid()) {
74497449
PartialStruct.LowestElem = {FieldIndex, LowestElem};
7450-
if (IsFinalArraySection) {
7450+
if (IsFinalArraySection && OASE) {
74517451
Address HB =
74527452
CGF.EmitArraySectionExpr(OASE, /*IsLowerBound=*/false)
74537453
.getAddress();
@@ -7460,7 +7460,7 @@ class MappableExprsHandler {
74607460
} else if (FieldIndex < PartialStruct.LowestElem.first) {
74617461
PartialStruct.LowestElem = {FieldIndex, LowestElem};
74627462
} else if (FieldIndex > PartialStruct.HighestElem.first) {
7463-
if (IsFinalArraySection) {
7463+
if (IsFinalArraySection && OASE) {
74647464
Address HB =
74657465
CGF.EmitArraySectionExpr(OASE, /*IsLowerBound=*/false)
74667466
.getAddress();

clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ void MacOSKeychainAPIChecker::checkPreStmt(const CallExpr *CE,
314314
RegionArgIsBad = true;
315315
}
316316

317+
assert(ArgSM);
317318
// Is the argument to the call being tracked?
318319
const AllocationState *AS = State->get<AllocatedData>(ArgSM);
319320
if (!AS)

0 commit comments

Comments
 (0)