Commit Graph

208 Commits

Author SHA1 Message Date
Daniel Marjamäki a1fafa7f06 Library: added <formatstr> and <strz> to argument checks 2013-07-22 20:21:45 +02:00
Daniel Marjamäki fa7f8ddc78 Library: Renamed Argument to ArgumentChecks to make it a bit more clear 2013-07-16 09:40:31 +02:00
Daniel Marjamäki d25e7d4a21 Library: fixed problems 2013-07-16 08:21:38 +02:00
Daniel Marjamäki 24dfc052e2 astyle formatting 2013-07-15 21:57:58 +02:00
Daniel Marjamäki 7443883b9c Library: Improved handling in CheckNullPointer::parseFunctionCall for Library data 2013-07-15 18:55:40 +02:00
Daniel Marjamäki c389e08353 Fixed #4728 (simplify known variables better (%var% & %num%, bitwise and)) 2013-06-26 18:13:28 +02:00
Daniel Marjamäki 10849e220b Fixed #4809 (Review CheckNullPointer::parseFunctionCall) 2013-06-07 06:37:53 +02:00
Daniel Marjamäki 079d22fbee Fixed #4734 (False 'Possible null pointer dereference') 2013-05-03 16:18:44 +02:00
Zachary Blair 35668380cf Fixed #4510 (False positive: "Possible null pointer dereference if the default parameter value is used" after init) 2013-04-25 00:25:56 -07:00
Daniel Marjamäki 4e65800adf TestRunner: Updated warning message when there is unsimplified code 2013-04-16 16:54:19 +02:00
Daniel Marjamäki fdac502c39 Simplified TestNullPointer test cases 2013-04-15 19:00:15 +02:00
PKEuS 693c6e84cb Removed more duplicate unit tests 2013-04-13 01:49:17 -07:00
Daniel Marjamäki 38680e3440 Fixed #4677 (Message for 'possible null pointer dereference, otherwise it is redundant to check..' is warning but says error) 2013-04-07 03:41:02 +02:00
PKEuS 51685f24c5 Improved expression parsing in CheckNullPointer::isPointerDeRef() - fixed #4692 2013-04-03 01:27:08 -07:00
Ettl Martin 1b9c1c03fa unittests: removed not needed '\n' at the end of testcases. 2013-03-20 15:36:16 +01:00
Ettl Martin 7c0905cd4e #4665 added todo unittest 2013-03-19 08:47:05 +01:00
zblair ed03e2c845 Fixed #4539 (False positive: Possible null pointer dereference) 2013-02-27 23:45:21 -08:00
Daniel Marjamki abd536b84c Null pointer: Changed 'possible null pointer dereference - otherwise condition is redundant' to warning 2013-02-02 15:46:29 +01:00
Daniel Marjamäki fc42aa3a30 Fixed #4523 (false positive: (error) Possible null pointer dereference) 2013-01-30 16:52:12 +01:00
Daniel Marjamäki 509dd9a989 Fixed #4523 (false positive: (error) Possible null pointer dereference) 2013-01-29 17:12:14 +01:00
Frank Zingsheim 096cb1bd88 Fixed #3686: false positive: Possible null pointer dereference (inconclusive) 2013-01-21 19:38:59 +01:00
Zachary Blair 309edbbdc5 Fixed #4389 (False positive: Possible null pointer dereference if the default parameter value is used) 2013-01-09 23:22:54 -08:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Daniel Marjamäki f127d56719 Null pointer: Fixed FP when there are 'return p?p->x:0;' 2012-12-25 14:23:50 +01:00
PKEuS 4737966caf Unit test cleanup: Removed some empty lines and whitespaces before \n. 2012-12-06 10:19:22 -08:00
Zachary Blair 095824373a Fixed #3302 (new check: nullpointer dereference) 2012-11-20 23:56:17 -08:00
PKEuS 4ee955fc8c Improved CheckNullPointer::isPointerDeRef():
- Fixed #4240
- Added support for wstring/wchar_t
2012-11-10 19:53:20 +01:00
Robert Reif 8e14d7682c Symbol database: fix some function prototype bugs that were found during check conversions. Ticket: #4266 2012-10-30 15:48:06 +01:00
Daniel Marjamäki fefd8529c6 Fixed #4007 (False positive: 'Possible null pointer dereference' when using short-circuit evaluation) 2012-10-07 19:06:49 +02:00
Daniel Marjamäki c9c04f9691 Fixed #4038 (FP: possible null pointer dereference) 2012-09-23 09:20:16 +02:00
Daniel Marjamäki ffd5c82b4f Fixed #4118 (False null-pointer warning when check is indirect) 2012-09-18 19:16:28 +02:00
PKEuS 31e7e41098 Fixed and refactorized broken CheckNullPointer::CanFunctionAssignPointer():
- return true if parameter is passed by reference (fixes #4111)
- Use symboldatabase
- Improved handling of inconclusive
2012-09-06 18:33:15 +02:00
Daniel Marjamäki 985ac662ee Fixed #4035 (False positive: Memory leak: pTempFile) 2012-08-25 12:00:25 +02:00
PKEuS 35d94c26d5 Changed creation of SymbolDatabase. Database always created after Tokenizer::tokenize() and Tokenizer::simplifyTokenList() instead of on-demand creation by Tokenizer::getSymbolDatabase.
-> With Token::scope() it is possible to access the symboldatabase without having to call getSymbolDatabase(). The change increases safety because it is guaranteed that the database is available in all checks, even if the specific check doesn't call getSymbolDatabase
- Tokenizer::_symbolDatabase does no longer have to be mutable -> Increased const correctness

The change above required two additional changes:
- A bug causing a debug message was fixed in the symboldatabase that became visible in the test suite by the change above.
- Simplify expressions like "struct struct Foo" which might be result of typedef instanciation.
2012-08-12 03:01:24 -07:00
PKEuS 25ecd3ed71 Message refactorization: checknullpointer.cpp
Removed a duplicate test in checknullpointer.cpp
2012-08-05 01:38:48 -07:00
Daniel Marjamäki a733c9b603 Fixed #3914 (false positive null pointer dereference, assignment in conditional) 2012-07-23 10:05:55 +02:00
Daniel Marjamäki d1b4bea304 Fixed #3807 (False positive: possible null pointer dereference) 2012-05-31 18:41:00 +02:00
PKEuS e8cd119ebd Improved parsing of functions that accept nullpointers but no uninitialized data (Fixed #3811) 2012-05-16 00:56:39 -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
Daniel Marjamäki d5442280b1 Fixed #3597 (Errors in evaluation of chained assignment operators) 2012-05-01 07:06:14 +02:00
PKEuS 8e362ad5f7 Fixed #3771
Stronger testing for false positives in inconclusive checking in checknullpointer.cpp
2012-04-30 12:36:41 +02:00
Daniel Marjamäki 6ae135124e Tokenizer::setVarId: better handling of initializer lists 2012-04-23 18:26:27 +02:00
PKEuS fc8749e952 Improved nullpointer check:
- Fixed #3673
- Fixed potential issue with constructor calls (like #3697)
- Added support for operator+ on std::string
2012-04-02 12:12:02 +02:00
Ettl Martin 8e9c09659f astyle run 2012-04-01 15:56:48 +02:00
Ettl Martin 083954049f #1927 added testcase. 2012-04-01 15:54:41 +02:00
PKEuS 0340764726 Improved nullpointer check: Detect dereferences by streams (#410)
Refactorizations:
- Replaced || by %oror% in Token::Match patterns
- Replaced some simple patterns by direct comparisions, replaced Match call with simpleMatch
- Increased data encapsulation by making more members private in CheckNullpointer
2012-03-16 17:24:03 +01:00
August Sodora e0bee0e037 Fixed #3567 (False positives in boolean expressions) 2012-03-07 20:31:23 +01:00
PKEuS 2e13a51d08 Fixed #3591 2012-02-13 19:46:45 +01:00
Erik Lax f1dbd1a89a Fixed #3518 (False negative: Possible null pointer dereference (in the same condition)) 2012-02-11 16:15:38 +01:00
PKEuS 42f418db54 - Improved nullpointer check: Fixed #1171
- Improved accuracy of function analysis in symboldatabase
- Code cleanups
2012-02-11 12:26:48 +01:00
Daniel Marjamäki 036b2a84bf Fixed #3570 (False Postive for 'nullPointer' check) 2012-02-01 20:38:47 +01:00
PKEuS 22c1ce8a68 Fixes for #3480 and #3568. 2012-01-31 15:49:34 +01:00
Daniel Marjamäki 01f6bbda62 Null pointers: fixed false positive when '?' is used in return statement. Ticket: #3560 2012-01-28 08:06:03 +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
PKEuS 42a75692d4 Improved nullpointer check:
- More accurate checking for dereferences and non-dereferences
- improved checking for nullpointer dereferences after return statement
- Supports pointer dereferences by std::string
- Code optimization/refactorization
2012-01-25 15:16:22 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Daniel Marjamäki 385afffb14 Null pointers: show inconclusive errors if functions are called. Assume they won't assign the pointer. Ticket: #3443 2011-12-26 07:13:10 +01:00
Daniel Marjamäki b742c03b65 Fixed #3443 (false positives: possible null pointer dereference (calling unknown function)) 2011-12-25 17:01:45 +01:00
Daniel Marjamäki 2bb5de4c89 Fixed #3425 (False positive: Null pointer dereference (pointer is checked in macro)) 2011-12-18 13:33:23 +01:00
Daniel Marjamäki e008a0508b Null pointers: Fixed false positive when sizeof without parentheses are used 2011-12-17 12:44:11 +01:00
Daniel Marjamäki e2dd085b60 Fixed #3394 (False positive: possible null pointer dereference) 2011-12-08 19:30:14 +01:00
Daniel Marjamäki c90558f730 Fixed #3358 (False null pointer dereference positive with ternary ?: operator) 2011-12-03 13:10:07 +01:00
Daniel Marjamäki 9a84c5845a Fixed #3373 (False posititive: incorrect %* handling in sscanf) 2011-12-02 17:09:32 +01:00
Daniel Marjamäki 6763e596b9 Fixed #3345 (false positive: possible null pointer dereference (guarded by &&)) 2011-12-02 06:11:55 +01:00
PKEuS ee3e10ea97 Fixed #3364 (Crash in printf parsing) 2011-11-30 20:23:29 +01:00
PKEuS be0acad11f Improvements to Nullpointer dereference on function call check:
printf format string parser improved (similar to my recent patch
on the argument counter), frexp/modf supported (#1572), Code
cleanup
2011-11-28 22:32:07 +02:00
PKEuS 6b1594244e code cleanups and refactorings 2011-11-26 21:15:16 +01:00
Richard Quirk d76657fec8 Fix false positives for null pointer on exit 2011-11-23 21:27:15 +01:00
Richard Quirk 527236b321 Fix false positives for delete of known nulls 2011-11-13 22:38:34 +01:00
Daniel Marjamäki 8bbd535267 Fixed #3290 (False positive: Null pointer dereference (typeid)) 2011-11-11 09:58:17 +01:00
Reijo Tomperi 7b7e072b88 Fix #3278 (FP: Possible null pointer dereference with for loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/3278
Bail out if token "for" is encountered.
2011-11-07 22:10:21 +02:00
Benjamin Goose 54c445ca20 Add tests for various bugs.
False positive: uninitialized variable (ticket #3287).
False positive: null pointer dereference in typeid (ticket #3290).
2011-11-04 12:27:32 +01:00
Daniel Marjamäki 63937f592e Fixed #3228 (false positive: possible null pointer dereference) 2011-10-30 17:59:38 +01:00
Daniel Marjamäki d75ef01d2b Null pointer: Added inconclusive error message when calling member function of NULL object. 2011-10-29 15:48:54 +02:00
Reijo Tomperi 5e0e2c4782 Fix #3256 (Null pointer dereference not detected)
http://sourceforge.net/apps/trac/cppcheck/ticket/3256
It is now detected if --inconclusive command line argument is given (the argument is unofficial currently)
2011-10-29 11:35:31 +03:00
Thomas Jarosch e3c67fed12 Run astyle 2011-10-28 22:43:02 +02:00
Ettl Martin 4a14672d0b added unittest for ticket #1780 2011-10-27 23:54:03 +02:00
Reijo Tomperi 36ef8e771f Improve null pointer dereference test coverage 2011-10-24 00:36:57 +03:00
Marek Zmysłowski b332ea8222 Fixed #3204 (Refactor standards support in Settings) 2011-10-22 09:45:48 +02:00
Daniel Marjamäki 3d18fdfa3f Fixed #3220 (False positive: possible null pointer dereference: 'SwDoc *pDoc = NULL; pDoc->do_something();') 2011-10-18 19:34:14 +02:00
PKEuS f8074b71d2 Fixed #2470 (False negative: Possible null pointer dereference (C++0x keyword 'nullptr')) 2011-10-16 12:54:58 +02:00
PKEuS 71a1d98693 Fixed ##3211 (Crash in gitHEAD when arglist count is smaller than format string) 2011-10-16 07:06:18 +02:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
PKEuS 91d7621994 Fixed #3180 (New check: Detect nullpointers given to printf via variable argument list) 2011-10-12 22:11:27 +02:00
Daniel Marjamäki 175503ef94 Null pointer: improved inconclusive checking in CheckNullPointer::nullPointerAfterLoop 2011-10-09 15:09:02 +02:00
Daniel Marjamäki 0b09732881 Null pointers: fixed false negatives when there are '(p && ..' 2011-10-08 12:58:10 +02:00
Daniel Marjamäki e2ec5a127f Fixed #3128 (False positive: null pointer dereference check does not handle complex boolean logic properly) 2011-10-07 21:08:21 +02:00
Daniel Marjamäki 480c403511 Fixed #3125 (FP: Possible null pointer dereference in conditional operator) 2011-10-02 19:27:18 +02:00
Daniel Marjamäki b2d0e48a31 Fixed #3126 (false positive: Null pointer dereference) 2011-10-02 18:24:45 +02:00
Daniel Marjamäki d098ed6031 Fixed #3065 (False positive: possible null pointer dereference: vi) 2011-09-03 19:43:27 +02:00
Daniel Marjamäki 27b29e5b8e Fixed #3023 (False positive: no possible null pointer dereference here: 'WARN_ON(!abc || abc->x == 0);') 2011-08-20 09:47:55 +02:00
Daniel Marjamäki a6a966e28e Null pointer: Fixed false positive when condition contains assignment 'if (p==NULL && (p=malloc(10))!=NULL) *p=0;' 2011-08-07 17:06:25 +02:00
Kimmo Varis cfcfa3f000 Use "enabled" list for the style checking.
Settings-class currently enables style checking via dedicated
boolean attribute. All other CLI's enable-options are handled
through the enable-list. This commit moves style-check enabling
to use the enable-list.

Main advantage is the consistency how options are handled/stored
in the Settings class. Which also unifies using them for the other
code. You need to enable certain type of checks? Use the
addEnabled()-method. You want to check if certain type of checks
are enabled? Use the isEnabled()-method.
2011-08-07 10:28:52 +03:00
Daniel Marjamäki 493cfa5df2 Null pointer: Added todo test case to better handle dereference in condition 2011-08-02 17:20:13 +02:00
Daniel Marjamäki 08f27564fa Null pointer: reduce false negatives in pointerDerefAndCheck 2011-08-02 17:04:07 +02:00
Daniel Marjamäki 825dce5c4e Fixed #2954 (False negative: Null pointer dereference not detected '*p=4; if (p) { }') 2011-08-02 11:20:09 +02:00
Daniel Marjamäki 0c2f2e1c38 Null pointers: Fixed false negative when struct is dereferenced in condition 2011-08-01 21:57:23 +02:00
Daniel Marjamäki a6c7ae8d51 Fixed #2789 (null pointer: problems not detected when pointer is assigned and checked if it's null in a if statement) 2011-08-01 07:51:32 +02:00
Daniel Marjamäki 1640f3d1ca Null pointer: fix false negatives when unknown function is called and pointer is local/argument 2011-07-31 17:32:25 +02:00
Daniel Marjamäki cc89687e8c Null pointer: better handling when calling standard functions with possible null pointer 2011-07-31 17:19:23 +02:00