Skip to content

Commit

Permalink
added cmd line option for nullptrdereference
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanLin520 committed Aug 28, 2024
1 parent 6c0914d commit 4dcf995
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions svf/include/AE/Svfexe/AEDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,25 @@ class NullPtrDerefDetector: public AEDetector {
* @param node Pointer to the ICFG node.
*/
void detect(AbstractState& as, const ICFGNode* node);

/**
* @brief Reports all detected buffer overflow bugs.
*/
void reportBug()
{
// if (!nodeToBugInfo.empty())
// {
// std::cerr << "######################Buffer Overflow (" + std::to_string(nodeToBugInfo.size())
// + " found)######################\n";
// std::cerr << "---------------------------------------------\n";
// for (const auto& it : nodeToBugInfo)
// {
// std::cerr << it.second << "\n---------------------------------------------\n";
// }
// }
std::cerr << "###################### NULL POINTER DEREFERENCE found ######################\n";
std::cerr << "---------------------------------------------\n";
}
};

}
2 changes: 2 additions & 0 deletions svf/include/Util/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ class Options
static const Option<std::string> OutputName;
/// buffer overflow checker, Default: false
static const Option<bool> BufferOverflowCheck;
/// null pointer dereference checker, Default: false
static const Option<bool> NullPtrDereference;
/// memory leak check, Default: false
static const Option<bool> MemoryLeakCheck;
/// file open close checker, Default: false
Expand Down
2 changes: 2 additions & 0 deletions svf/lib/Util/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,8 @@ const Option<std::string> Options::OutputName(
"output","output db file","output.db");
const Option<bool> Options::BufferOverflowCheck(
"overflow","Buffer Overflow Detection",false);
const Option<bool> Options::NullPtrDereference(
"nullptr_dereference","Null Pointer Dereference Detection",false);
const Option<bool> Options::MemoryLeakCheck(
"leak", "Memory Leak Detection",false);
const Option<bool> Options::FileCheck(
Expand Down

0 comments on commit 4dcf995

Please sign in to comment.