From aca8e66b8b005765373e41cbf00c09d0a9cf461b Mon Sep 17 00:00:00 2001 From: Vladislav Kalugin Date: Wed, 6 Sep 2023 12:59:10 +0300 Subject: [PATCH] Fix nullpointer deref --- server/src/KleeGenerator.cpp | 3 ++- server/src/fetchers/FunctionDeclsMatchCallback.cpp | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/server/src/KleeGenerator.cpp b/server/src/KleeGenerator.cpp index efb39e9d9..918d93a34 100644 --- a/server/src/KleeGenerator.cpp +++ b/server/src/KleeGenerator.cpp @@ -97,8 +97,9 @@ static std::string getUTBotClangCompilerPath(fs::path clientCompilerPath) { } } -static const std::unordered_set UNSUPPORTED_FLAGS_AND_OPTIONS_KLEE = { +static const std::unordered_set UNSUPPORTED_FLAGS_AND_OPTIONS_KLEE = { "--coverage", + "-lgcov", "-fbranch-target-load-optimize", "-fcx-fortran-rules", "-fipa-cp-clone", diff --git a/server/src/fetchers/FunctionDeclsMatchCallback.cpp b/server/src/fetchers/FunctionDeclsMatchCallback.cpp index b821c9665..b28267840 100644 --- a/server/src/fetchers/FunctionDeclsMatchCallback.cpp +++ b/server/src/fetchers/FunctionDeclsMatchCallback.cpp @@ -173,8 +173,13 @@ void FunctionDeclsMatchCallback::addFunctionPointer( LOG_S(WARNING) << "Type '" << name << "' fetch as function pointer but can't get functionType"; } } else if (type.isArrayOfPointersToFunction()) { - functionPointers[name] = ParamsHandler::getFunctionPointerDeclaration( - qualType->getPointeeType()->getPointeeType()->getAs(), name, - sourceManager, true); + const clang::FunctionType *functionType = qualType->getPointeeType()->getPointeeType()->getAs(); + if (functionType) { + functionPointers[name] = ParamsHandler::getFunctionPointerDeclaration( + functionType, name, + sourceManager, true); + } else { + LOG_S(WARNING) << "Type '" << name << "' fetch as function pointer but can't get functionType"; + } } }