Commit Graph

330 Commits

Author SHA1 Message Date
Daniel Marjamäki ea60c5b14b CheckBufferOverrun: Code cleanup 2013-05-05 08:14:19 +02:00
PKEuS c487ea843d Better fix for #4706: Use Token::nextArgument() properly. Removed redundant ' in message 2013-04-09 08:30:53 -07:00
Ettl Martin ba8cca8fa9 #4706 fix crash when a struct member is used as first argument. Replaced Token::nexArgument with %any% in Token::Match call. Added unittests in testing Token::nexArgument. 2013-04-04 15:12:18 +02:00
XhmikosR 99fc5f6203 checkbufferoverrun.cpp: fix a /W4 MSVC warning 2013-03-30 19:06:13 +01:00
Ettl Martin a08083a342 #4664: using Token::nextArgument() and std::string & 2013-03-20 11:53:25 +01:00
Ettl Martin ff826d7c62 #4664: new check: (POSIX) write outside buffer size. 2013-03-19 08:22:48 +01:00
Daniel Marjamäki fe046a3350 CheckBufferOverrun: Fixed Cppcheck warning 'variable scope can be reduced' (found by travis) 2013-03-14 18:25:28 +01:00
PKEuS 096fa2f771 Fixed #4380 2013-03-14 10:18:48 -07:00
Robert Reif 4b9b87e310 Fixed #4646 (false positive: (style, inconclusive) Technically the member function 'C<T>::operator+=' can be const.) 2013-03-14 06:34:12 +01:00
PKEuS d78c06dc3f Replaced _settings->isEnabled("style") by _settings->isEnabled("warning") wherever warnings are issued 2013-03-03 02:41:59 -08:00
PKEuS f899e6ca30 Changed behaviour of %op% pattern accordingly to changes to Token::isOp(). Added %cop% as replacement for old %op% 2013-03-01 02:43:59 -08:00
PKEuS 27f7917349 Changed severity and message formatting of argumentSize message. 2013-02-16 00:52:27 -08:00
Robert Reif 42588e9729 Fixed #4535 (Simplify checks by caching symbol database Variable pointer in Token) 2013-02-06 06:39:58 +01:00
Robert Reif 94c953931d Simplify checks by caching symbol database Variable pointer in Token 2013-01-31 20:08:48 +01:00
Robert Reif ec1c86c152 Symbol database: more function/variable cleanup. Ticket: #4494 2013-01-31 06:41:18 +01:00
Robert Reif 859793731d SymbolDatabase: Refactor findFunction handling. Ticket: #4494 2013-01-28 06:47:48 +01:00
Andrew C. Martin 4a73c93750 Fix compiler warnings and comment/string typos
- fix g++ warning:

> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions

 - fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522)):

> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).

- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)

- fix word misspellings (mostly comments, a few output lines)

  - Parenthesis => Parentheses (both variations were used in the codebase)

  - fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():

```
-  "An unsigned variable will never alwayw be positive so it is either pointless or "
+  "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Thomas Jarosch 78316f02b6 Fix comment about wrong magic number 2012-12-28 11:31:50 +01:00
Thomas Jarosch 4708be09f5 Fixed #4444 (segmentation fault) 2012-12-28 11:15:18 +01:00
Robert Reif ce380301fd Fixed #4432 (Crash on parsing PHP interpreter) 2012-12-26 08:29:10 +01:00
Daniel Marjamäki 7f6a10599b Fixed #4262 (Small Request/Suggestion for checks on array size of args (bounty offer)) 2012-12-22 09:23:34 +01:00
Daniel Marjamäki 365a260ddc Fixed #4398 (False negative: out of bounds (for loop)) 2012-12-22 08:00:05 +01:00
Edoardo Prezioso 5101f3c029 Use the new pattern: '%comp%' where possible.
Change also the description comment of the Token::Match by adding the new pattern and the forgotten '%op%'.
2012-12-01 01:31:35 +01:00
Daniel Marjamäki 031adef6ea Array index checking: Fixed TODO comment (false negatives when using ?:) 2012-11-30 09:01:15 +01:00
Daniel Marjamäki 1c4afbce8c Cleanup: Removed += and -= patterns from the checks. These should be simplified. 2012-11-30 07:08:16 +01:00
Robert Reif 0f8db28d30 speed up checks by caching commonly looked up stuff in the symbol database (CheckBufferOverrun, CheckBoost) 2012-10-13 11:16:48 +02:00
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