Skip to content

Commit 5ddab3f

Browse files
CallBase Called Function getName Null Check (#680)
* Null checking getCalledFunction() when calling getName() * minor * pre-commit --------- Co-authored-by: SanthoshMohan <santhoshmohan0897@gmail.com>
1 parent 02e832d commit 5ddab3f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDESecureHeapPropagation.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ IDESecureHeapPropagation::getCallToRetFlowFunction(
8787
// Change to CallSite everywhere
8888
const auto *CS = llvm::cast<llvm::CallBase>(CallSite);
8989

90-
auto FName = CS->getCalledFunction()->getName();
91-
if (FName == InitializerFn) {
92-
return generateFromZero(SecureHeapFact::INITIALIZED);
90+
if (const auto *Callee = CS->getCalledFunction()) {
91+
if (Callee->getName() == InitializerFn) {
92+
return generateFromZero(SecureHeapFact::INITIALIZED);
93+
}
9394
}
9495
return identityFlow();
9596
}
@@ -147,7 +148,7 @@ IDESecureHeapPropagation::getCallToRetEdgeFunction(
147148
return SHPGenEdgeFn{l_t::INITIALIZED};
148149
}
149150
const auto *CS = llvm::cast<llvm::CallBase>(CallSite);
150-
if (CallNode != ZeroValue &&
151+
if (CallNode != ZeroValue && CS->getCalledFunction() &&
151152
CS->getCalledFunction()->getName() == ShutdownFn) {
152153
// std::cerr << "Kill at " << llvmIRToShortString(callSite) << std::endl;
153154
return SHPGenEdgeFn{l_t::BOT};

0 commit comments

Comments
 (0)