From 5ddab3f2ebfb7b289657937928ba45eb95cbf9fe Mon Sep 17 00:00:00 2001 From: Fabian Schiebel <52407375+fabianbs96@users.noreply.github.com> Date: Wed, 15 Nov 2023 09:13:23 +0100 Subject: [PATCH] CallBase Called Function getName Null Check (#680) * Null checking getCalledFunction() when calling getName() * minor * pre-commit --------- Co-authored-by: SanthoshMohan --- .../IfdsIde/Problems/IDESecureHeapPropagation.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDESecureHeapPropagation.cpp b/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDESecureHeapPropagation.cpp index a06853787..225b701fa 100644 --- a/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDESecureHeapPropagation.cpp +++ b/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDESecureHeapPropagation.cpp @@ -87,9 +87,10 @@ IDESecureHeapPropagation::getCallToRetFlowFunction( // Change to CallSite everywhere const auto *CS = llvm::cast(CallSite); - auto FName = CS->getCalledFunction()->getName(); - if (FName == InitializerFn) { - return generateFromZero(SecureHeapFact::INITIALIZED); + if (const auto *Callee = CS->getCalledFunction()) { + if (Callee->getName() == InitializerFn) { + return generateFromZero(SecureHeapFact::INITIALIZED); + } } return identityFlow(); } @@ -147,7 +148,7 @@ IDESecureHeapPropagation::getCallToRetEdgeFunction( return SHPGenEdgeFn{l_t::INITIALIZED}; } const auto *CS = llvm::cast(CallSite); - if (CallNode != ZeroValue && + if (CallNode != ZeroValue && CS->getCalledFunction() && CS->getCalledFunction()->getName() == ShutdownFn) { // std::cerr << "Kill at " << llvmIRToShortString(callSite) << std::endl; return SHPGenEdgeFn{l_t::BOT};