Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SVF::BufferOverflowBug Class Reference

#include <SVFBugReport.h>

Inheritance diagram for SVF::BufferOverflowBug:
SVF::GenericBug SVF::FullBufferOverflowBug SVF::PartialBufferOverflowBug

Public Member Functions

 BufferOverflowBug (GenericBug::BugType bugType, const EventStack &eventStack, s64_t allocLowerBound, s64_t allocUpperBound, s64_t accessLowerBound, s64_t accessUpperBound)
 
cJSONgetBugDescription () const
 
void printBugToTerminal () const
 
- Public Member Functions inherited from SVF::GenericBug
 GenericBug (BugType bugType, const EventStack &bugEventStack)
 note: should be initialized with a bugEventStack
 
virtual ~GenericBug ()=default
 
BugType getBugType () const
 returns bug type
 
const std::string getLoc () const
 returns bug location as json format string
 
const std::string getFuncName () const
 return bug source function name
 
const EventStackgetEventStack () const
 

Static Public Member Functions

static bool classof (const GenericBug *bug)
 ClassOf.
 

Protected Attributes

s64_t allocLowerBound
 
s64_t allocUpperBound
 
s64_t accessLowerBound
 
s64_t accessUpperBound
 
- Protected Attributes inherited from SVF::GenericBug
BugType bugType
 
const EventStack bugEventStack
 

Additional Inherited Members

- Public Types inherited from SVF::GenericBug
enum  BugType {
  FULLBUFOVERFLOW , PARTIALBUFOVERFLOW , NEVERFREE , PARTIALLEAK ,
  DOUBLEFREE , FILENEVERCLOSE , FILEPARTIALCLOSE , FULLNULLPTRDEREFERENCE ,
  PARTIALNULLPTRDEREFERENCE
}
 
typedef std::vector< SVFBugEventEventStack
 
- Static Public Attributes inherited from SVF::GenericBug
static const std::map< GenericBug::BugType, std::string > BugType2Str
 

Detailed Description

Definition at line 121 of file SVFBugReport.h.

Constructor & Destructor Documentation

◆ BufferOverflowBug()

SVF::BufferOverflowBug::BufferOverflowBug ( GenericBug::BugType  bugType,
const EventStack eventStack,
s64_t  allocLowerBound,
s64_t  allocUpperBound,
s64_t  accessLowerBound,
s64_t  accessUpperBound 
)
inline

Definition at line 127 of file SVFBugReport.h.

129 :
GenericBug(BugType bugType, const EventStack &bugEventStack)
note: should be initialized with a bugEventStack
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Member Function Documentation

◆ classof()

static bool SVF::BufferOverflowBug::classof ( const GenericBug bug)
inlinestatic

ClassOf.

Definition at line 138 of file SVFBugReport.h.

139 {
140 return bug->getBugType() == GenericBug::PARTIALBUFOVERFLOW || bug->getBugType() == GenericBug::FULLBUFOVERFLOW;
141 }

◆ getBugDescription()

cJSON * BufferOverflowBug::getBugDescription ( ) const
virtual

◆ printBugToTerminal()

void BufferOverflowBug::printBugToTerminal ( ) const
virtual

Implements SVF::GenericBug.

Definition at line 79 of file SVFBugReport.cpp.

80{
83 {
84 SVFUtil::errs() << SVFUtil::bugMsg1("\t Full Overflow :") << " accessing at : ("
85 << GenericBug::getLoc() << ")\n";
86
87 }
88 else
89 {
90 SVFUtil::errs() << SVFUtil::bugMsg1("\t Partial Overflow :") << " accessing at : ("
91 << GenericBug::getLoc() << ")\n";
92 }
93 bugInfo << "\t\t allocate size : [" << allocLowerBound << ", " << allocUpperBound << "], ";
94 bugInfo << "access size : [" << accessLowerBound << ", " << accessUpperBound << "]\n";
95 SVFUtil::errs() << "\t\t Info : \n" << bugInfo.str();
96 SVFUtil::errs() << "\t\t Events : \n";
97
98 for(auto event : bugEventStack)
99 {
100 switch(event.getEventType())
101 {
103 {
104 SVFUtil::errs() << "\t\t callsite at : ( " << event.getEventLoc() << " )\n";
105 break;
106 }
107 default:
108 {
109 // TODO: implement more events when needed
110 break;
111 }
112 }
113 }
114}
static bool classof(const GenericBug *bug)
ClassOf.
const std::string getLoc() const
returns bug location as json format string
const EventStack bugEventStack
std::string bugMsg1(const std::string &msg)
Definition SVFUtil.cpp:82
std::ostream & errs()
Overwrite llvm::errs()
Definition SVFUtil.h:56

Member Data Documentation

◆ accessLowerBound

s64_t SVF::BufferOverflowBug::accessLowerBound
protected

Definition at line 124 of file SVFBugReport.h.

◆ accessUpperBound

s64_t SVF::BufferOverflowBug::accessUpperBound
protected

Definition at line 124 of file SVFBugReport.h.

◆ allocLowerBound

s64_t SVF::BufferOverflowBug::allocLowerBound
protected

Definition at line 124 of file SVFBugReport.h.

◆ allocUpperBound

s64_t SVF::BufferOverflowBug::allocUpperBound
protected

Definition at line 124 of file SVFBugReport.h.


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