Static Value-Flow Analysis
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
SVF::GenericBug Class Referenceabstract

#include <SVFBugReport.h>

Inheritance diagram for SVF::GenericBug:
SVF::BufferOverflowBug SVF::DoubleFreeBug SVF::FileNeverCloseBug SVF::FilePartialCloseBug SVF::FullNullPtrDereferenceBug SVF::NeverFreeBug SVF::PartialLeakBug SVF::PartialNullPtrDereferenceBug

Public Types

enum  BugType {
  FULLBUFOVERFLOW , PARTIALBUFOVERFLOW , NEVERFREE , PARTIALLEAK ,
  DOUBLEFREE , FILENEVERCLOSE , FILEPARTIALCLOSE , FULLNULLPTRDEREFERENCE ,
  PARTIALNULLPTRDEREFERENCE
}
 
typedef std::vector< SVFBugEventEventStack
 

Public Member Functions

 GenericBug (BugType bugType, const EventStack &bugEventStack)
 note: should be initialized with a bugEventStack More...
 
virtual ~GenericBug ()=default
 
BugType getBugType () const
 returns bug type More...
 
const std::string getLoc () const
 returns bug location as json format string More...
 
const std::string getFuncName () const
 return bug source function name More...
 
const EventStackgetEventStack () const
 
virtual cJSONgetBugDescription () const =0
 
virtual void printBugToTerminal () const =0
 

Static Public Attributes

static const std::map< GenericBug::BugType, std::stringBugType2Str
 

Protected Attributes

BugType bugType
 
const EventStack bugEventStack
 

Detailed Description

Definition at line 80 of file SVFBugReport.h.

Member Typedef Documentation

◆ EventStack

Definition at line 83 of file SVFBugReport.h.

Member Enumeration Documentation

◆ BugType

Enumerator
FULLBUFOVERFLOW 
PARTIALBUFOVERFLOW 
NEVERFREE 
PARTIALLEAK 
DOUBLEFREE 
FILENEVERCLOSE 
FILEPARTIALCLOSE 
FULLNULLPTRDEREFERENCE 
PARTIALNULLPTRDEREFERENCE 

Definition at line 86 of file SVFBugReport.h.

Constructor & Destructor Documentation

◆ GenericBug()

SVF::GenericBug::GenericBug ( BugType  bugType,
const EventStack bugEventStack 
)
inline

note: should be initialized with a bugEventStack

Definition at line 95 of file SVFBugReport.h.

95  :
97  {
98  assert(bugEventStack.size() != 0 && "bugEventStack should NOT be empty!");
99  }
const EventStack bugEventStack
Definition: SVFBugReport.h:91

◆ ~GenericBug()

virtual SVF::GenericBug::~GenericBug ( )
virtualdefault

Member Function Documentation

◆ getBugDescription()

virtual cJSON* SVF::GenericBug::getBugDescription ( ) const
pure virtual

◆ getBugType()

BugType SVF::GenericBug::getBugType ( ) const
inline

returns bug type

Definition at line 103 of file SVFBugReport.h.

104  {
105  return bugType;
106  }

◆ getEventStack()

const EventStack& SVF::GenericBug::getEventStack ( ) const
inline

Definition at line 112 of file SVFBugReport.h.

113  {
114  return bugEventStack;
115  }

◆ getFuncName()

const std::string GenericBug::getFuncName ( ) const

return bug source function name

Definition at line 57 of file SVFBugReport.cpp.

58 {
59  const SVFBugEvent&sourceInstEvent = bugEventStack.at(bugEventStack.size() -1);
60  return sourceInstEvent.getFuncName();
61 }
virtual const std::string getFuncName() const

◆ getLoc()

const std::string GenericBug::getLoc ( ) const

returns bug location as json format string

Definition at line 51 of file SVFBugReport.cpp.

52 {
53  const SVFBugEvent&sourceInstEvent = bugEventStack.at(bugEventStack.size() -1);
54  return sourceInstEvent.getEventLoc();
55 }
virtual const std::string getEventLoc() const

◆ printBugToTerminal()

virtual void SVF::GenericBug::printBugToTerminal ( ) const
pure virtual

Member Data Documentation

◆ bugEventStack

const EventStack SVF::GenericBug::bugEventStack
protected

Definition at line 91 of file SVFBugReport.h.

◆ bugType

BugType SVF::GenericBug::bugType
protected

Definition at line 90 of file SVFBugReport.h.

◆ BugType2Str

const std::map< GenericBug::BugType, std::string > GenericBug::BugType2Str
static
Initial value:
=
{
{GenericBug::FULLBUFOVERFLOW, "Full Buffer Overflow"},
{GenericBug::PARTIALBUFOVERFLOW, "Partial Buffer Overflow"},
{GenericBug::NEVERFREE, "Never Free"},
{GenericBug::PARTIALLEAK, "Partial Leak"},
{GenericBug::FILENEVERCLOSE, "File Never Close"},
{GenericBug::FILEPARTIALCLOSE, "File Partial Close"},
{GenericBug::DOUBLEFREE, "Double Free"},
{GenericBug::FULLNULLPTRDEREFERENCE, "Full Null Ptr Dereference"},
{GenericBug::PARTIALNULLPTRDEREFERENCE, "Partial Null Ptr Dereference"}
}

Definition at line 87 of file SVFBugReport.h.


The documentation for this class was generated from the following files: