|
Cppcheck
|
Check for buffer overruns (using ExecutionPath) More...
Public Member Functions | |
| ExecutionPathBufferOverrun (Check *c, const std::map< unsigned int, CheckBufferOverrun::ArrayInfo > &arrayinfo) | |
| Startup constructor. | |
Private Member Functions | |
| ExecutionPath * | copy () |
| Copy this check. | |
| bool | is_equal (const ExecutionPath *e) const |
| is other execution path equal? | |
| void | operator= (const ExecutionPathBufferOverrun &) |
| no implementation => compiler error if used by accident | |
| ExecutionPathBufferOverrun (Check *c, const std::map< unsigned int, CheckBufferOverrun::ArrayInfo > &arrayinfo, unsigned int varid_) | |
| internal constructor for creating extra checks | |
| const Token * | parse (const Token &tok, std::list< ExecutionPath * > &checks) const |
| Parse tokens at given location. | |
Static Private Member Functions | |
| static void | assign_value (std::list< ExecutionPath * > &checks, unsigned int varid, const std::string &value) |
| Assign value to a variable. | |
| static void | array_index (const Token *tok, std::list< ExecutionPath * > &checks, unsigned int varid1, unsigned int varid2) |
| Found array usage, analyse the array usage. | |
Private Attributes | |
| const std::map< unsigned int, CheckBufferOverrun::ArrayInfo > & | arrayInfo |
| Buffer information. | |
| MathLib::bigint | value |
| Variable value. | |
Check for buffer overruns (using ExecutionPath)
Definition at line 2035 of file checkbufferoverrun.cpp.
| ExecutionPathBufferOverrun::ExecutionPathBufferOverrun | ( | Check * | c, |
| const std::map< unsigned int, CheckBufferOverrun::ArrayInfo > & | arrayinfo | ||
| ) | [inline] |
Startup constructor.
Definition at line 2038 of file checkbufferoverrun.cpp.
| ExecutionPathBufferOverrun::ExecutionPathBufferOverrun | ( | Check * | c, |
| const std::map< unsigned int, CheckBufferOverrun::ArrayInfo > & | arrayinfo, | ||
| unsigned int | varid_ | ||
| ) | [inline, private] |
internal constructor for creating extra checks
Definition at line 2061 of file checkbufferoverrun.cpp.
| static void ExecutionPathBufferOverrun::array_index | ( | const Token * | tok, |
| std::list< ExecutionPath * > & | checks, | ||
| unsigned int | varid1, | ||
| unsigned int | varid2 | ||
| ) | [inline, static, private] |
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 2095 of file checkbufferoverrun.cpp.
References CheckBufferOverrun::arrayIndexOutOfBoundsError(), arrayInfo, CheckBufferOverrun::ArrayInfo::num(), ExecutionPath::owner, value, and ExecutionPath::varId.
| static void ExecutionPathBufferOverrun::assign_value | ( | std::list< ExecutionPath * > & | checks, |
| unsigned int | varid, | ||
| const std::string & | value | ||
| ) | [inline, static, private] |
Assign value to a variable.
| checks | the execution paths |
| varid | the variable id |
| value | the assigned value |
Definition at line 2076 of file checkbufferoverrun.cpp.
References MathLib::toLongNumber(), value, and ExecutionPath::varId.
| ExecutionPath* ExecutionPathBufferOverrun::copy | ( | ) | [inline, private, virtual] |
Copy this check.
Called from the ExecutionPath baseclass.
Implements ExecutionPath.
Definition at line 2044 of file checkbufferoverrun.cpp.
| bool ExecutionPathBufferOverrun::is_equal | ( | const ExecutionPath * | e | ) | const [inline, private, virtual] |
is other execution path equal?
Implements ExecutionPath.
Definition at line 2049 of file checkbufferoverrun.cpp.
References value.
| void ExecutionPathBufferOverrun::operator= | ( | const ExecutionPathBufferOverrun & | ) | [private] |
no implementation => compiler error if used by accident
| const Token* ExecutionPathBufferOverrun::parse | ( | const Token & | tok, |
| std::list< ExecutionPath * > & | checks | ||
| ) | const [inline, private, virtual] |
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 2124 of file checkbufferoverrun.cpp.
References Token::Match(), Token::next(), Token::previous(), Token::strAt(), Token::tokAt(), and Token::varId().
const std::map<unsigned int, CheckBufferOverrun::ArrayInfo>& ExecutionPathBufferOverrun::arrayInfo [private] |
Buffer information.
Definition at line 2055 of file checkbufferoverrun.cpp.
Referenced by array_index().
Variable value.
Definition at line 2068 of file checkbufferoverrun.cpp.
Referenced by array_index(), assign_value(), and is_equal().
1.7.6.1