Cppcheck
|
Check for buffer overruns (using ExecutionPath) More...
Public Member Functions | |
ExecutionPathBufferOverrun (Check *c, const std::map< unsigned int, CheckBufferOverrun::ArrayInfo > &arrayinfo) | |
Startup constructor. More... | |
Public Member Functions inherited from ExecutionPath | |
ExecutionPath (Check *c, unsigned int id) | |
virtual | ~ExecutionPath () |
void | print () const |
print checkdata More... | |
virtual bool | parseCondition (const Token &tok, std::list< ExecutionPath * > &checks) |
Parse condition. More... | |
virtual void | parseLoopBody (const Token *tok, std::list< ExecutionPath * > &checks) const |
Parse loop body. More... | |
virtual void | end (const std::list< ExecutionPath * > &, const Token *) const |
going out of scope - all execution paths end More... | |
bool | operator== (const ExecutionPath &e) const |
Private Member Functions | |
ExecutionPath * | copy () |
Copy this check. More... | |
bool | is_equal (const ExecutionPath *e) const |
is other execution path equal? More... | |
void | operator= (const ExecutionPathBufferOverrun &) |
no implementation => compiler error if used by accident More... | |
ExecutionPathBufferOverrun (Check *c, const std::map< unsigned int, CheckBufferOverrun::ArrayInfo > &arrayinfo, unsigned int varid_) | |
internal constructor for creating extra checks More... | |
const Token * | parse (const Token &tok, std::list< ExecutionPath * > &checks) const |
Parse tokens at given location. More... | |
Static Private Member Functions | |
static void | assign_value (std::list< ExecutionPath * > &checks, unsigned int varid, const std::string &value) |
Assign value to a variable. More... | |
static void | array_index (const Token *tok, std::list< ExecutionPath * > &checks, unsigned int varid1, unsigned int varid2) |
Found array usage, analyse the array usage. More... | |
Private Attributes | |
const std::map< unsigned int, CheckBufferOverrun::ArrayInfo > & | arrayInfo |
Buffer information. More... | |
MathLib::bigint | value |
Variable value. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from ExecutionPath | |
static void | bailOut (std::list< ExecutionPath * > &checks) |
bail out all execution paths More... | |
static void | bailOutVar (std::list< ExecutionPath * > &checks, const unsigned int varid) |
bail out execution paths with given variable id More... | |
static void | checkScope (const Token *tok, std::list< ExecutionPath * > &checks) |
Public Attributes inherited from ExecutionPath | |
unsigned int | numberOfIf |
number of if blocks More... | |
const unsigned int | varId |
Protected Attributes inherited from ExecutionPath | |
Check *const | owner |
Check for buffer overruns (using ExecutionPath)
Definition at line 2027 of file checkbufferoverrun.cpp.
|
inline |
Startup constructor.
Definition at line 2030 of file checkbufferoverrun.cpp.
|
inlineprivate |
internal constructor for creating extra checks
Definition at line 2053 of file checkbufferoverrun.cpp.
|
inlinestaticprivate |
Found array usage, analyse the array usage.
tok | token where usage occurs (only used when reporting the error) |
checks | The execution paths |
varid1 | variable id for the array |
varid2 | variable id for the index |
Definition at line 2087 of file checkbufferoverrun.cpp.
References CheckBufferOverrun::arrayIndexOutOfBoundsError(), arrayInfo, CheckBufferOverrun::ArrayInfo::num(), ExecutionPath::owner, value, and ExecutionPath::varId.
|
inlinestaticprivate |
Assign value to a variable.
checks | the execution paths |
varid | the variable id |
value | the assigned value |
Definition at line 2068 of file checkbufferoverrun.cpp.
References MathLib::toLongNumber(), value, and ExecutionPath::varId.
|
inlineprivatevirtual |
Copy this check.
Called from the ExecutionPath baseclass.
Implements ExecutionPath.
Definition at line 2036 of file checkbufferoverrun.cpp.
|
inlineprivatevirtual |
is other execution path equal?
Implements ExecutionPath.
Definition at line 2041 of file checkbufferoverrun.cpp.
References value.
|
private |
no implementation => compiler error if used by accident
|
inlineprivatevirtual |
Parse tokens at given location.
tok | token to parse |
checks | The execution paths. All execution paths in the list are executed in the current scope. |
Implements ExecutionPath.
Definition at line 2118 of file checkbufferoverrun.cpp.
References Token::Match(), Token::next(), Token::previous(), Token::strAt(), Token::tokAt(), and Token::varId().
|
private |
Buffer information.
Definition at line 2047 of file checkbufferoverrun.cpp.
Referenced by array_index().
|
private |
Variable value.
Definition at line 2060 of file checkbufferoverrun.cpp.
Referenced by array_index(), assign_value(), and is_equal().