Commit Graph

303 Commits

Author SHA1 Message Date
Daniel Marjamäki 68240fffc6 Fixed #4228 ((error) Internal error. Token::Match called with varid 0 (multiple declarations in for loop)) 2012-09-23 17:15:39 +02:00
Daniel Marjamäki ec01cc811e Second fix for #4207 (Internal error. Token::Match called with varid 0) 2012-09-23 13:25:28 +02:00
Daniel Marjamäki a17f37c67d CheckBufferOverrun: Better handling of functions with variable arguments 2012-09-22 16:19:19 +02:00
PKEuS 508e9394d3 Added some nullpointer-checks and removed some redundant ones based on VS2012 code analysis results. 2012-09-17 15:22:51 +02:00
XhmikosR 6e4e3dfbfb lib: tabs to spaces, remove trailing spaces and extra empty lines at the end of files 2012-09-17 13:51:23 +02:00
PKEuS 547d3e94b2 Fixed some sign conversion messages from clang. 2012-09-16 16:41:15 +02:00
PKEuS 22a8e3f4e6 Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better. 2012-09-11 18:03:47 +02:00
Daniel Marjamäki 64faa780fe Fixed #4087 (div by zero check is invalid for floats) 2012-09-11 16:50:42 +02:00
Daniel Marjamäki 6b56b4a9d3 Show that inconclusive message is inconclusive 2012-09-07 16:11:15 +02:00
PKEuS a4b5824dec New internal check: checkRedundantNextPrevious().
Fixed findings by new internal check
2012-09-07 12:36:40 +02:00
PKEuS e4a693eaab Refactorizations:
- Fixed several findings of CheckInternal.
- Removed some debug code from CheckOther::checkRedundantAssignment().
2012-09-07 11:59:20 +02:00
PKEuS 8c70778b70 Refactorization: Fixed several messages when self-checking cppcheck 2012-09-04 15:29:51 +02:00
Deepak Gupta 4202866100 Fixed #4096 (Improve check: Buffer overrun in for loop, postfix increment in array access) 2012-09-01 19:17:28 +02:00
Daniel Marjamäki 8afdde0b5e Fixed #3931 (FP: Buffer access out-of-bounds) 2012-08-12 17:06:54 +02:00
PKEuS c8773b891d Refactorization: Make use of Token::scope() replacing certain indentation counters 2012-08-12 03:13:07 -07:00
Edoardo Prezioso fae40c4782 Change every C version of 'size_t' to C++ 'std::size_t'. 2012-07-09 13:30:18 +02:00
PKEuS 639f15645a Message refactorization: checkbufferoverrun.cpp (2), checkclass.cpp, checkexceptionsafety.h 2012-07-09 02:11:05 -07:00
PKEuS ed7e950671 Message refactorization: checkbufferoverrun.cpp 2012-07-08 06:51:24 -07:00
Daniel Marjamäki 848fd59cbd Fixed #3913 (boundcheck, false positive continue in loop) 2012-07-08 14:34:47 +02:00
Daniel Marjamäki 5de82c1c42 Updated arrayIndexOutOfBounds error message. Thank you Kimmo for the suggestion. 2012-06-23 09:51:32 +02:00
Daniel Marjamäki 4e98cb3ed9 Fixed #3907 (improve check: detect buffer overrun when using && or || in for loop) 2012-06-23 09:23:14 +02:00
Daniel Marjamäki ac524c56ad Reviewed handling of unknown types in ExecutionPathBufferOverrun 2012-06-23 08:15:59 +02:00
Daniel Marjamäki 7d59d86ed6 Fixed #3893 (Improve check: Array index out of bounds not detected when down conting) 2012-06-16 17:44:51 +02:00
PKEuS 9dc8123151 Refactorizations:
- Use const string references instead of const strings copies when possible
- Fixed cppcheck warning about postfix increment in CheckIO
- Use symbolDatabase to detect pointers in CheckOther::checkAssignBoolToPointer
2012-05-25 03:09:41 -07:00
PKEuS dc64ac2918 Removed unnecessary variable Function::start - The value is already stored in Function::functionScope->classStart. 2012-05-22 12:58:46 -07:00
Andy Maloney 12c5980c01 Fix compiler warning about initialization order 2012-05-18 13:59:19 -04:00
PKEuS de79a4c84f Fixed initialization list usage according to cppcheck results
Fixed comments mentioning nonexistent parameters
2012-05-18 07:57:11 -07:00
PKEuS ec00824fd3 Fixed #3357:
- Print "inconclusive" tag in cli
- Fixed inconclusive handling in checkbufferoverrun.cpp
- Merged reportInconclusiveError into reportError by adding an additional parameter "bool inconclusive" which is false per default
2012-05-06 10:37:41 -07:00
PKEuS 1a5fbd61d2 Splitted class TokenList from Tokenizer 2012-05-05 09:33:26 -07:00
Ettl Martin bb8342fbb4 fixed misspelled word 'Comparision' --> 'Comparison' 2012-04-26 23:04:55 +02:00
PKEuS dd5e9aa454 Make use of recently implemented Token::type() functionality 2012-04-25 09:56:07 +02:00
PKEuS b37cf11d20 Refactorizations:
- Increased encapsulation by making some functions private
- Removed redundant function CheckBufferOverrun::ArrayInfo::declare
- Avoided copy of ArrayInfo object
- Removed unnecessary and suspicious "if(sizeof(int) == 4)"
2012-03-27 19:40:39 +02:00
PKEuS e3b3b7b62f Refactorizations on buffer overrun check:
- Replaced a few indendation counters by smaller and faster code
- Make use of safer nextArgument() function instead of some local implementations
- Replaced some simple patterns by direct function calls
- Made a strncpy/strncat search pattern more generic
- Replaced offset variable by incrementation of Token* to avoid subsequent calls to tokAt
- Increased data encapsulation in header
2012-03-17 21:55:08 +01:00
Daniel Marjamäki 4f3878eb1e Fixed #3569 (false negative: buffer access out of bounds) 2012-03-13 21:30:03 +01:00
Daniel Marjamäki a9480ca0c1 CheckBufferOverrun: move condition before loop 2012-03-13 21:19:10 +01:00
PKEuS 1747813a8b Added check for invalid pointer casts (#1255)
Detect sign extension problems when variable is a reference (#3637)
Refactorizations:
- Tokenizer::getFiles returns a reference instead of a pointer, because its guaranteed that no nullpointer is returned
- Remove signed/unsigned in one step for "%type% signed|unsigned"
- Fixed recently introduced compiler warning in symboldatabase.cpp
2012-02-26 11:56:32 +01:00
PKEuS 5c2af0b2e3 - initialising std::string with 0 in initialisation list is partially detected in nullpointer check (#3520)
- executionpath checking makes use of symboldatabase
- CheckExceptionSafety::checkRethrowCopy makes use of symboldatabase
2012-01-26 16:50:59 +01:00
Reijo Tomperi 194327048a Add InternalError and change MathLib to throw it in case of an error.
- Previously MathLib errors did not provide a filename, but after this change at least source file name should be printed
and if token is provided, also line number should be printed.
- Change also Token to use InternalError
- Modify Cppcheck-class to catch InternalError instead of Token
- Run dmake to update Makefile
2012-01-08 22:19:44 +02:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Edoardo Prezioso 8f2ad53332 Add testcase for previous commit. 2011-12-30 18:47:42 +01:00
PKEuS dca03c3ce2 Remove unnecessary includes
Also add a unit test related to #3427
Also improve the description text in checkclass and remove unused variable.
2011-12-23 23:31:48 +02:00
Daniel Marjamäki 1ba1be4b8d Fixed #3428 (false negative: array bounds errors not found when duplicate class names present) 2011-12-18 16:35:51 +01:00
Daniel Marjamäki 772b8cc37d Array index out of bounds: Avoid false positives when there are duplicate names for structs 2011-12-18 08:12:42 +01:00
Daniel Marjamäki 5f712cc213 Array index out of bounds: Fixed false positive when taking address beyond array using calculated array index 2011-12-17 21:35:12 +01:00
PKEuS f306246c7f Improved support for references and pointers in SymbolDatabase
Replaced several isPointer functions by Variable::isPointer function
Refactorizations & Make use of symbolDatabase more often
2011-12-17 19:04:03 +01:00
Daniel Marjamäki 95123854ba Array index out of bounds: Fixed false positive when size is not known. 2011-12-17 13:20:42 +01:00
Daniel Marjamäki ffb5d107be CheckNullPointer::isPointerDeRef: Tweaks to reduce false warnings when inconclusive is used. 2011-12-11 08:48:55 +01:00
Daniel Marjamäki 497c54a1a7 Fixed #3168 (false negative: buffer overflow in subfunction) 2011-12-11 08:16:58 +01:00
Daniel Marjamäki ee39f6402c reverted fix for #3168, I'll rewrite it 2011-12-10 20:46:10 +01:00
Daniel Marjamäki 897e8637b4 Fixed #3168 (false negative: buffer overflow in subfunction) 2011-12-10 19:26:12 +01:00