Commit Graph

12146 Commits

Author SHA1 Message Date
chrchr-github 111f4e17da
Fix FP nullPointerArithmetic when adding 0 () 2022-06-03 13:11:54 +02:00
orbitcowboy 1a4bd0a7b3 Fixed FP, found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/k/knot/knot_3.1.8.orig.tar.xz; knot-3.1.8/tests/knot/test_confio.c:301:18: error: Invalid strcmp() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-03 13:10:45 +02:00
orbitcowboy 345411a68c Fixed FP found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/i/imx-usb-loader/imx-usb-loader_0~git20200517.30b43d69.orig.tar.gz; imx_usb_loader/imx_loader_config.c:130:16: error: Invalid strncat() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-03 10:20:19 +02:00
orbitcowboy a59e510cdc Fixed FP - invalidFunctionArgStr, found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/i/ion/ion_3.2.1+dfsg.orig.tar.gz; ion-open-source/arch-rtems/pmqlsi.c:146:18: error: Invalid mq_send() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-03 10:06:32 +02:00
orbitcowboy 8382ea7692 std.cfg: Improved configuration of strpbrk() and added regression tests. These cases were found in the wild (daca@home: ftp://ftp.de.debian.org/debian/pool/main/i/ion/ion_3.2.1+dfsg.orig.tar.gz, ion-open-source/contrib/dtnperf/dtnperf/src/utils.c:71:32: error: Invalid strpbrk() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr]). 2022-06-03 08:36:25 +02:00
orbitcowboy 4e9565b4e6 Fixed FP invalidFunctionArgStr, found a daca@home: ftp://ftp.de.debian.org/debian/pool/main/h/haskell-hs-bibutils/haskell-hs-bibutils_6.10.0.0.orig.tar.gz 2022-06-02 23:39:04 +02:00
Paul Fultz II 72342de0da
Fix 11114: FP knownConditionTrueFalse across functions ()
* Fix 11114: FP knownConditionTrueFalse across functions

* Format
2022-06-02 23:24:11 +02:00
Oliver Stöneberg 133b9c2790
some `test/CMakeLists.txt` cleanups ()
* test/CMakeLists.txt: removed unnecessary `CTest` include - gets rid of additional CTest/CDash targets

* test/CMakeLists.txt: adjusted CMake version - `CMAKE_MATCH_<n>` requires 3.9`

* test/CMakeLists.txt: sorted `add_cfg()` calls

* test/CMakeLists.txt: extract test fixtures based on `REGISTER_TEST` macro

* test/CmakeLists.txt: added TODO
2022-06-02 22:26:01 +02:00
orbitcowboy 67795cdfcf
Fixed FPs from Ticket 11119 - invalidFunctionArgStr with null-terminated strings ()
* Fixed first FP from  - invalidFunctionArgStr with null-terminated strings

* Fixed second test case from .

* Fixed another FP, found on daca@home ftp://ftp.de.debian.org/debian/pool/main/g/glhack/glhack_1.2.orig.tar.gz.

* Format
2022-06-02 19:30:29 +02:00
orbitcowboy 58460edaf8 Fixed crash due to missing null pointer check. 2022-06-02 11:32:55 +02:00
orbitcowboy 0eae0023a3 posix.cfg: Added missing '<strz/>'-flags 2022-06-02 09:41:10 +02:00
orbitcowboy 63a8eac4d3 std.cfg: Added missing '<strz/>'-flags 2022-06-02 09:23:22 +02:00
orbitcowboy 886b5d1039 Improved invalidFunctionArgStr checking and detect more cases where a NON-null-terminated string is used to call functions, configured with <strz/>. 2022-06-02 01:09:09 +02:00
chrchr-github cd7362e0e7
Fix FN with default init ()
* Fix  FP: variableScope when using range constructor to vector

* Format

* Fix FN with default init
2022-06-01 23:18:59 +02:00
chrchr-github 2452a2c01d
Fix FP: variableScope when using range constructor to vector ()
* Fix  FP: variableScope when using range constructor to vector

* Format
2022-06-01 21:15:41 +02:00
chrchr-github 423e67bd6a
Fix FP memleak () 2022-05-30 06:55:15 +02:00
Paul Fultz II d7c914bd3e
Handle subfunction values in valueflow conditions () 2022-05-29 19:57:10 +02:00
chrchr-github 7fbb9c7c13
Fix FN constVariable with range-based for loop ()
* Fix  FN constVariable with range-based for loop

* Format

* nullptr check

* Restrict scopes

* Add const

* Undo

* Add more const
2022-05-29 17:06:33 +02:00
chrchr-github e1c51940a2
Fix FP constParameter with decremented pointer () 2022-05-28 08:32:58 +02:00
chrchr-github 16a4449901
Fix crash with statement expression () 2022-05-28 00:11:23 +02:00
chrchr-github 16af6561c2
Fix FP memleak with unknown ptr typedef ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member

* Fix FP memleak with function call, fix cppcheckError

* Fix FP memleak with array

* Fix FPs memleak with array and ptr to ptr

* Fix FP memleak with unknown ptr typedef

* Format
2022-05-27 23:52:56 +02:00
chrchr-github d5d6da0dd4
Fix FP unreadVariable with unique_ptr and unknown type () 2022-05-27 17:17:50 +02:00
orbitcowboy 558e00272d windows.cfg: Improved configuration of _mbscmp() and _mbscmp_l(). 2022-05-27 12:28:30 +02:00
Rikard Falkeborn 068e5bad27
Fix : FP memleak with multiple assignments in if-statement ()
Similar to how we do for assignments outside if-statements, bail out
since we do not track multiple variables.
2022-05-27 07:57:43 +02:00
chrchr-github 19dd59eae6
Fix FPs memleak with array and ptr to ptr ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member

* Fix FP memleak with function call, fix cppcheckError

* Fix FP memleak with array

* Fix FPs memleak with array and ptr to ptr
2022-05-26 15:27:36 +02:00
chrchr-github 86763b7b0a
Fix FP memleak with array ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member

* Fix FP memleak with function call, fix cppcheckError

* Fix FP memleak with array
2022-05-26 00:03:30 +02:00
chrchr-github 2b611709e2
Add test for () 2022-05-25 23:28:54 +02:00
chrchr-github 1ed280fe63
Fix FP memleak with function call, fix cppcheckError ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member

* Fix FP memleak with function call, fix cppcheckError
2022-05-24 14:02:06 +02:00
chrchr-github 2ceaf308de
Fix : ValueType for pointer typedef, don't warn for typedef'd pointers, improve error message ()
* Fix ValueType for pointer typedef

* Add test

* Don't warn for typedef'd pointers, improve error message

* Fix tests

* Add TODO

* Fix test

* Set isSimplifiedTypedef() for more tokens, add test

* Add test
2022-05-24 10:09:48 +02:00
orbitcowboy c30333425b Added a regression test for ticket - FN: knownConditionTrueFalse 2022-05-24 09:21:21 +02:00
Paul Fultz II 5999b35130
Fix 10944: FN: knownConditionTrueFalse ()
* Fix 10944: FN: knownConditionTrueFalse

* Use or

* Format
2022-05-23 23:22:08 +02:00
chrchr-github 1ced94be43
Fix FN memleak with redundant pointer op / FN: Memory leak not detected on struct member ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member
2022-05-23 23:21:36 +02:00
Paul Fultz II e2c35abde5
Fix 11050: False positive: unreadVariable for class variable when another function uses the same variable name () 2022-05-22 09:20:32 +02:00
chrchr-github 22a4fdb6c4
Fix crash in checkPassByReference() () 2022-05-21 16:02:35 +02:00
Daniel Marjamäki 1f6554e2e8 Update copyright year 2022-05-21 12:18:27 +02:00
chrchr-github 2a7f00cf9a
Fix FN Condition '...' is always true ' uint16_t i; ( i <= 0xFFFF)' () 2022-05-21 08:33:42 +02:00
Paul Fultz II feaef46436
Fix 11076: Assert failure / crash with loop over init list () 2022-05-21 08:25:09 +02:00
Paul Fultz II a62fb986a5
Fix 11090: Infinite recursion in findTypeInBase() () 2022-05-21 08:24:29 +02:00
chrchr-github 2b723eafcb
Fix ValueType for references in range-based for loop ()
* Fix ValueType for references in range-based for loop

* Format
2022-05-20 08:48:01 +02:00
chrchr-github 112b1573c5
Fix FN constructing string from nullptr / FN unread variables ()
* Fix  FN constructing string from nullptr /  FN unread variables

* Format
2022-05-18 13:52:44 +02:00
Paul Fultz II 90e6c10c12
Fix 11072: FP arrayIndexOutOfBounds, nullPointer with nested loops ()
* Fix 11072: FP arrayIndexOutOfBounds, nullPointer with nested loops

* Format

* Remove print statement
2022-05-18 08:29:30 +02:00
orbitcowboy 06216b06fc Fixed failing CI. 2022-05-15 08:53:21 +02:00
orbitcowboy 4f410ffb79
library: Improved argument <valid>-interface to defined values that are explicitly excluded. ()
* library: Improved <valid>-interface to defined values that are explicitly excluded.

* std.cfg: Improved configuration of remainder[fl]().

* Fixed failing self check

* Fixed failing self check

* std.cfg: Added support for std::remquo().
2022-05-14 16:05:18 +02:00
chrchr-github 52f507d1fb
Fix unintentional semicolon in expression '.. ; +dostuff();' ()
* Fix  unintentional semicolon in expression '.. ; +dostuff();'

* Improve error message

* Don't remove single unary + in front of variables
2022-05-13 06:54:02 +02:00
Paul Fultz II fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member ()
* Fix 11057: FP danglingTemporaryLifetime with reference member

* Add test

* Format

* Use ast for number of arguments

* Get number of arguments using ast

* Skip aggregate constructor when there are too many arguments

* Format
2022-05-13 06:51:07 +02:00
Paul Fultz II 5f9bee9b91
Fix 11056: FP uninitvar with known condition in loop ()
* Fix 11056: FP uninitvar with known condition in loop

* Format
2022-05-12 06:37:48 +02:00
Paul Fultz II 6d3208ecb0
Fix 11062: false positive: knownEmptyContainer (regression) ()
* Fix 11062: false positive: knownEmptyContainer (regression)

* Format
2022-05-12 06:24:16 +02:00
Paul Fultz II 5d8da2b83c
Fix 11035: FP arrayIndexOutOfBoundsCond with array and vector ()
* Fix 11035: FP arrayIndexOutOfBoundsCond with array and vector

* Format

* Move comment
2022-05-12 06:21:33 +02:00
chrchr-github e7e8b1baf9
Fix FN: "static" not suggested for non-const method ()
* Fix  FN: "static" not suggested for non-const method

* Format

* Make functions static

* static
2022-05-11 20:01:22 +02:00
chrchr-github 63a1698335
Fix FP multiCondition when variable is assigned in if/else () 2022-05-11 20:01:13 +02:00
orbitcowboy d0b7fe887a Added a regression test for - Comparing Boolean variables (> or <) 2022-05-11 11:30:02 +02:00
chrchr-github 942dbad11c
Fix not getting expected warning in relational comparison of booleans ()
* Fix  not getting expected warning in relational comparison of booleans

* return nullptr
2022-05-11 08:09:32 +02:00
orbitcowboy e9641e6de5 std.cfg: Attempt to fix failing CI 2022-05-10 23:09:10 +02:00
Daniel Marjamäki 72ba85a2fc AST: Fix AST for array size calculation in cast (char (*)[...]) 2022-05-10 22:47:57 +02:00
Daniel Marjamäki 4257f9d46a Tokenizer: fix for __attribute__ before function that returns a reference 2022-05-10 20:59:24 +02:00
chrchr-github a70d11adb6
Fix inline static global struct declaration interferes with checks () 2022-05-10 20:43:11 +02:00
orbitcowboy f23111d610 std.cfg: Improved configuration of some <thread.h> (since C11) functions. 2022-05-10 19:21:41 +02:00
chrchr-github e2bb77f990
Remove severity 'experimental' from checkComparisonOfBoolWithBool() ()
* Enable experimental check

* Remove experimental

* Don't compare Booleans using relational operators
2022-05-10 18:25:13 +02:00
chrchr-github ad547af6f9
Add tests for , , ()
* Add tests for , 

* Add test for 

* Add tests for , 

* Add test for 

* Comment
2022-05-10 18:25:01 +02:00
orbitcowboy 57e35513b9 std.cfg: Improved testing of std::system() 2022-05-10 13:53:16 +02:00
chrchr-github 52cbbb0229
Fix FP uninitMemberVar with defaulted special member functions ()
* Fix  FN: duplicateExpression with multiple strings compared

* Fix compiler warning

* TODO -> ASSERT

* Update testautovariables.cpp

* Improve error message

* Format

* Improve message

* Fix FP with defaulted operator=

* Fix condition
2022-05-10 13:04:45 +02:00
Oliver Stöneberg 56ac230e97
added strict cfg check ()
* runtests.sh: added strict mode - enabled via `STRICT=1`

* CI-unixish.yml: added strict cfg check

* runtests.sh: disabled syntax check for kde.cpp since `kde-4config` is no longer commonly available in recent distros

* runtests.sh: disabled syntax check for opencv2.cpp since `opencv.pc` is not commonly available in distros

* runtests.sh: added missing trailing slash to `CFG` - fixes define checks
2022-05-10 13:03:58 +02:00
orbitcowboy 6152e5712a std.cfg: Improved configuration of std::filebuf::open(). 2022-05-10 10:17:27 +02:00
orbitcowboy 1382cd837e std.cfg: Improved configuration of std::*stream::open(). 2022-05-10 10:07:55 +02:00
orbitcowboy 6a3520164a std.cfg: Improved configuration of std::ifstream::open() and std::ios_base::open(). 2022-05-10 09:50:02 +02:00
orbitcowboy 440e8f9c22 std.cfg: Improved configuration of std::ofstream::write(), std::ostringstream::write(), std::ostream::write() and std::fstream(). 2022-05-10 09:30:13 +02:00
chrchr-github 54f832a2fe
Fix FN: duplicateExpression with multiple strings compared () 2022-05-09 21:05:35 +02:00
chrchr-github 38bdece3fe
Fix False negative: Uninitialized struct member (default constructor) ()
* Fix  False negative: Uninitialized struct member (default constructor)

* Format

* Initialize variables

* Init
2022-05-09 20:28:21 +02:00
Paul Fultz II be6daa94bb
Fix 11053: Integer division by zero in calculate.h ()
* Fix 11053: Integer division by zero in calculate.h

* Format
2022-05-09 20:27:32 +02:00
Paul Fultz II 69f09da63e
Fix 11044: FP knownConditionTrueFalse after early return ()
* Fix 11044: FP knownConditionTrueFalse after early return

* Format
2022-05-09 20:26:52 +02:00
chrchr-github 16ef2c1838
Add test for ()
* Add tests for , 

* Add test for 
2022-05-09 20:26:15 +02:00
chrchr-github 8c0561a78b
Add tests for , () 2022-05-09 14:52:31 +02:00
Daniel Marjamäki eb9c4b4aed Tokenizer: Fix handling of __attribute__ for overloaded operator function 2022-05-08 18:19:52 +02:00
orbitcowboy b847882994 std.cfg: Improved configuration of vfwprintf(). 2022-05-08 18:15:22 +02:00
orbitcowboy 0db793fc51 std.cfg: Improved configuration of vfprintf() 2022-05-08 18:06:30 +02:00
orbitcowboy 1942bd5679 std.cfg: Improved configuration of fprintf() and added TODO tests for wcsftime() when array count value exceeds bounds. 2022-05-08 18:02:10 +02:00
Daniel Marjamäki fab55287f7 Tokenizer: improved handling of __asm__ in function declaration 2022-05-08 16:03:09 +02:00
Daniel Marjamäki 449d351095 Revert "Tokenizer: handle when __asm__ directive is provided for function"
This reverts commit f25b8cf662.
2022-05-07 21:53:10 +02:00
Daniel Marjamäki f25b8cf662 Tokenizer: handle when __asm__ directive is provided for function 2022-05-07 19:40:03 +02:00
chrchr-github 612d7be85a
Fix syntaxError with unknown macros and using namespace () 2022-05-05 19:47:56 +02:00
orbitcowboy f3ae729f89 std.cfg: Improved configuration of fesetexceptflag() and fetestexcept(). 2022-05-05 15:07:06 +02:00
Paul Fultz II 843f7893d6
Fix 11040: FP nullPointer after loop () 2022-05-05 06:55:02 +02:00
Paul Fultz II 8d16ee946c
Fix 11027: False positive: containerOutOfBounds from condition in assert ()
* Fix 11027: False positive: containerOutOfBounds from condition in assert

* Format
2022-05-05 06:54:44 +02:00
Paul Fultz II 5afd6880c3
Fix 11028: False positive: invalidContainer ()
* Fix 11028: False positive: invalidContainer

* Format
2022-05-05 06:54:36 +02:00
chrchr-github adba751217
Fix FP uninitvar with redundant pointer op ()
* Skip redundant pointer op

* Fix   FP uninitvar with redundant pointer op

* Format
2022-05-05 06:54:27 +02:00
chrchr-github aebc080c0f
Fix FN constVariable with array of pointers [regression] ()
* Fix  FN constVariable with array of pointers [regression]

* Use std::vector for deterministic order of results, use helper variables
2022-05-05 06:54:03 +02:00
orbitcowboy 7c816425b9 gnu.cfg: Fixed compiler warning from GCC: warning: ‘struct servent’ declared inside parameter list will not be visible 2022-05-04 20:29:12 +02:00
chrchr-github 9a379925cd
FIx FN shadowVariable in static function ()
* FIx FN shadowVariable in static function

* Use functionOf
2022-05-04 17:56:16 +02:00
chrchr-github e2069dd1b9
Fix FN knownConditionTrueFalse with const int value () 2022-05-04 14:25:00 +02:00
Paul Fultz II 496b45f27b
Fix 11009: FP uninitvar ()
* Fix 11009: FP uninitvar

* Format
2022-05-04 05:59:01 +02:00
chrchr-github 1e40a2e73e
Fix C-style pointer casting not detected for casts to ** () 2022-05-03 20:15:42 +02:00
chrchr-github 509e42afd4
Fix FN duplicateCondition with struct member ()
* Fix  FN duplicateCondition with struct member

* Update testcondition.cpp
2022-05-03 19:57:30 +02:00
chrchr-github 51b4cf592b
Fix unknownMacro reported with noexcept (regression) () 2022-05-03 13:37:14 +02:00
orbitcowboy e293b66ac6 gnu.cfg: Added support for getservent_r(). 2022-05-03 11:54:28 +02:00
Paul Fultz II 3edb10a006
Fix 11024: FP returnDanglingLifetime with c_str() passed to constructor () 2022-05-03 11:42:32 +02:00
orbitcowboy 9f7c34272d Added a regression test for ticket - No UnreadVariable for simple class 2022-05-03 06:58:03 +02:00
chrchr-github 8ce0faf723
Fix Regression: selfInitialization () 2022-05-02 16:49:13 +02:00
orbitcowboy 5a7c998a79 posix.cfg: Improved configuration of getpwuid_r(). 2022-05-02 16:48:22 +02:00
orbitcowboy 8cc16f1adb posix.cfg: Improved configuration of getpwnam_r(). 2022-05-02 16:41:33 +02:00
chrchr-github 67f4fe575f
Fix syntaxError with attribute for function pointer () 2022-05-02 15:05:48 +02:00
orbitcowboy 6c54e7363d posix.cfg: Added support for fgetpwent_r(). 2022-05-02 12:56:47 +02:00
orbitcowboy 86cc410dc2 posix.cfg: Added support for getpwent_r(). 2022-05-02 12:51:58 +02:00
orbitcowboy ba57f33f81 posix.cfg: Added support for getgrnam_r() and getgrgid_r(). 2022-05-02 12:28:54 +02:00
orbitcowboy 0ec2d5f40d std.cfg: Improved configuration of qsort(). 2022-05-02 11:58:31 +02:00
orbitcowboy 6a657865eb posix.cfg: Improved test cases for ffs(). 2022-05-01 18:15:32 +02:00
orbitcowboy 6ad5a94acf gnu.cfg: Improved configuration for memrchr(). 2022-05-01 18:10:19 +02:00
orbitcowboy 6f6ddb99b2 std.cfg: Improved tests for memchr(). 2022-05-01 18:09:54 +02:00
chrchr-github e9a0d7979e
Fix FN redundantPointerOp / remove simplifyMulAndParens() () 2022-05-01 15:46:07 +02:00
orbitcowboy e0ccfea027 gnu.cfg: Improved configuration of ffsl() and ffsll() 2022-05-01 15:29:35 +02:00
orbitcowboy 178efb7058 posix.cfg: Improved configuration for ffs(). 2022-05-01 15:24:57 +02:00
orbitcowboy cbcbff7d12 posix.cfg: Improved tests for readlink(). 2022-05-01 14:17:49 +02:00
orbitcowboy 0e4a17e2ab posix.cfg: Improved configuration of readlinkat(). 2022-05-01 14:08:08 +02:00
orbitcowboy 5db6fc1f54 std.cfg: Improved configuration of localtime_s() 2022-05-01 12:47:13 +02:00
orbitcowboy 01a24d2ce0 posix.cfg: Improved configuration of recv(). 2022-05-01 12:27:14 +02:00
orbitcowboy d6af9da83d posix.cfg: Improved configuration of recvfrom(). 2022-05-01 12:24:15 +02:00
orbitcowboy 85f44d36dd gnu.cfg: Added support for semtimedop(). 2022-05-01 11:41:51 +02:00
orbitcowboy 63e58b9051 posix.cfg: Added support for semop(). 2022-05-01 11:41:31 +02:00
Paul Fultz II 3e686103ae
Fix 10984: False positive: invalidContainer when explictly capturing vector by reference () 2022-04-30 09:36:28 +02:00
Paul Fultz II 4e7125554f
Fix 8358: FP: Condition '(number*0)!=0' is always false () 2022-04-30 09:35:51 +02:00
Paul Fultz II 9fa5c4e201
Fix 11011: FP returnDanglingLifetime with non-const reference argument [inconclusive] ()
* Fix 11011: FP returnDanglingLifetime with non-const reference argument [inconclusive]

* Format
2022-04-30 08:23:58 +02:00
chrchr-github 6a914dc435
Add tests for # 10773, , ()
* Add test for 

* Add test for 

* Add test for 
2022-04-30 08:20:00 +02:00
chrchr-github e7afb3045b
Fix FP redundantPointerOp with macro ()
* Fix  FN: Redundant pointer operation

* Fix FP redundantPointerOp

* Check for LValue

* Fix FP redundantPointerOp with macro

* Format
2022-04-29 13:23:50 +02:00
chrchr-github 0467ab1339
Fix FN memleak with cfg () 2022-04-28 19:50:16 +02:00
chrchr-github 8dbe6994a2
Fix FP redundantPointerOp ()
* Fix  FN: Redundant pointer operation

* Fix FP redundantPointerOp

* Check for LValue
2022-04-28 15:25:31 +02:00
chrchr-github 3d3885d151
Add test for / Remove noisy assert ()
* Add test for 

* Remove noisy assert
2022-04-28 15:24:54 +02:00
Paul Fultz II aafd1e10be
Fix 11006: FP uninitvar with unknown constant () 2022-04-28 10:48:37 +02:00
chrchr-github 7cedf3e0e5
Partial fix for False positive: returnTempReference with trailing return type () 2022-04-27 20:11:32 +02:00
chrchr-github 034140e7e1
Fix FN: Redundant pointer operation () 2022-04-27 19:52:56 +02:00
chrchr-github bcbc29affb
Fix FP: negativeIndex if function call is made after index check ()
* Fix  FP: negativeIndex if function call is made after index check

* Improve container check

* Format
2022-04-27 14:08:44 +02:00
chrchr-github 6df0f9b3e3
Add tests for , , () 2022-04-27 12:43:21 +02:00
orbitcowboy 6796f9daa2 std.cfg: Moved strdup() from posix.cfg to std.cfg since its now part of C23. 2022-04-27 12:41:40 +02:00
orbitcowboy b2c3a9e9a3 posix.cfg: Improved configuration for send(). 2022-04-27 10:41:57 +02:00
orbitcowboy 9726dc8174 posix.cfg: Improved support for sendto(). 2022-04-27 10:35:43 +02:00
orbitcowboy fa1182c0f1 bsd.cfg: Added support for setbuffer() and setlinebuf(). 2022-04-27 10:22:38 +02:00
orbitcowboy 53ebb55e1f std.cfg: Improved configuration of setvbuf(). 2022-04-27 10:09:23 +02:00
orbitcowboy 561e21e2aa std.cfg: Improved tests for setbuf(). 2022-04-27 09:21:09 +02:00
orbitcowboy fa351e010b posix.cfg: Improved tests for socketpair() 2022-04-26 18:13:24 +02:00
orbitcowboy 17189e1d6e std.cfg: Improved configuration of strftime(). 2022-04-26 18:03:39 +02:00
Paul Fultz II 474c7fe5cc
Fix 10953: False positive: Possible null pointer dereference when calling derived function () 2022-04-26 17:57:06 +02:00
orbitcowboy 7d723a7a60 Merge branch 'main' of https://github.com/danmar/cppcheck into main 2022-04-26 17:51:24 +02:00
orbitcowboy 7e3ac96ebc std.cfg: Improved tests of vswprintf(). 2022-04-26 17:50:59 +02:00
chrchr-github 0dc3cb6eba
Fix FP nullPointerRedundantCheck with static function pointer () 2022-04-26 17:25:56 +02:00
orbitcowboy 0d35a60954 posix.cfg: Added support for drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48 and lcong48 - generate uniformly distributed pseudo-random numbers. 2022-04-26 17:24:39 +02:00
orbitcowboy bfbc7e1549 posix.cfg: Added support for getlogin_r(). 2022-04-26 10:04:15 +02:00
orbitcowboy bd1104d786 posix.cfg: Added support for pread(). 2022-04-26 09:37:08 +02:00
orbitcowboy 942375741b posix.cfg: Added support for pwrite(). 2022-04-26 09:26:39 +02:00
orbitcowboy bb98ccf7d4 Ticket - Added a regression test 2022-04-26 07:45:08 +02:00
chrchr-github 6b5df68677
Fix syntaxError for valid C code sizeof(enum ...) () 2022-04-26 07:22:53 +02:00
chrchr-github 961ecfbe33
Fix cppcheckError with nested template arguments () 2022-04-25 22:23:06 +02:00
chrchr-github 1bc0317719
Fix FP uninitStructMember with extra parentheses () 2022-04-25 22:22:35 +02:00
chrchr-github b4df064875
Fix FP AssignmentIntegerToAddress with volatile () 2022-04-25 22:00:37 +02:00
chrchr-github 81f9b9b2b7
Fix FP with ptr to ptr const () 2022-04-25 21:45:11 +02:00
orbitcowboy d7063806d1 posix.cfg: Improved configuration for swab(). 2022-04-25 18:34:31 +02:00
orbitcowboy d1b6954dd8 std.cfg: Improved configuration for wcsrtombs(). 2022-04-25 18:25:52 +02:00
orbitcowboy 31d0b0b73b posix.cfg: Improved configuration for wcsnrtombs(). 2022-04-25 15:54:44 +02:00
orbitcowboy 89ae22c0e1 posix.cfg: Improved configuration for wcsnrtombs(). 2022-04-25 15:49:37 +02:00
orbitcowboy dd2e218bb4 posix.cfg: Added some tests for ttyname_r(). 2022-04-25 12:46:27 +02:00
orbitcowboy d42bab47ae posix.cfg: Added support for wcsnrtombs(). 2022-04-25 12:26:02 +02:00
Paul Fultz II 6b9ac6f7a8
Warn when incrementing uninitialized value ()
* Warn when incrementing uninitialized value

* Format
2022-04-24 09:56:58 +02:00
Paul Fultz II 5d5562266d
ValueFlow: Assume constant is nonzero when its negated ()
* ValueFlow: Assume constant is nonzero when its negated

* Format

* Format
2022-04-23 06:19:07 +02:00
Paul Fultz II 4eed29502c
ValueFlow: Set values to parameters to longjmp and setjmp ()
* ValueFlow: Set values to parameters to longjmp and setjmp

* Format
2022-04-23 06:18:55 +02:00
Paul Fultz II 4fa2e3ac87
Use default template in the cfg tests () 2022-04-23 06:18:44 +02:00
orbitcowboy a75ecbca0e std.cfg: Improved tests for wcsftime(). 2022-04-22 08:29:20 +02:00
orbitcowboy 5d26d62698 posix.cfg: Added more test for wcpncpy(). 2022-04-22 08:23:17 +02:00
orbitcowboy 097438f308 posix.cfg: utimes() is a wrapper for utime(), which is obsolescent. Set utimes() as obsolescent as well. 2022-04-22 08:18:21 +02:00
orbitcowboy 478aa6754b posix.cfg: Added support for wcsncasecmp(). 2022-04-22 08:07:20 +02:00
orbitcowboy 0560a946a8 std.cfg: Added more tests 2022-04-22 08:00:45 +02:00
orbitcowboy 051512dd48 bsd.cfg: Added support for pwritev(), preadv(), writev() and writev(). 2022-04-22 07:41:03 +02:00
orbitcowboy b315e8a115 std.cfg: Added more tests for wmemmove() and wmemset(). 2022-04-22 07:25:27 +02:00
Oliver Stöneberg fdca61add9
aligned build options of Visual Studio project configurations and added them to CMake () 2022-04-21 21:28:29 +02:00
orbitcowboy 1bf7b3b7dd std.cfg: Added more tests for memcmp(), memcpy() and memmove(). 2022-04-21 21:01:38 +02:00
Paul Fultz II 3feecc51d6
Fix 10988: FP: Regression, uninitvar () 2022-04-21 19:29:38 +02:00
orbitcowboy ce35a6c975 std.cfg: Added more tests for strcat() and strcpy(). 2022-04-21 16:59:25 +02:00
orbitcowboy e683f3ce28 std.cfg: Added more test for strncpy(). 2022-04-21 16:47:19 +02:00
orbitcowboy 7f48127c0b std.cfg: Added more test for strncat(). 2022-04-21 16:43:52 +02:00
orbitcowboy a6f87e6b8a std.cfg: Added more test for strcmp(). 2022-04-21 16:13:48 +02:00
orbitcowboy e06169cf8d std.cfg: Added more test for strncmp() and wmemcmp(). 2022-04-21 16:09:36 +02:00
Oliver Stöneberg f53ad2391a
CMakeLists.txt: removed left-over Z3 code () 2022-04-21 12:54:16 +02:00
orbitcowboy 7c766a9696 gnu.cfg: Ensure a nullPointer warning is shown for invalid input to mempcpy() and wmempcpy(). 2022-04-21 09:19:32 +02:00
orbitcowboy c7ab35613e posix.cfg: Cleanup test case. 2022-04-21 09:10:13 +02:00
orbitcowboy 49057543a1 std.cfg: Ensure a warning is issued for null pointer input for strlen(). 2022-04-21 09:09:46 +02:00
orbitcowboy 3bd65d42cd posix.cfg: Fixed bufferAccessOutOfBounds falsen negative for strnlen() and added a TODO for wcsnlen() 2022-04-21 09:02:02 +02:00
orbitcowboy dad1a68e51 posix.cfg: Fixed FP bufferOverlap-warning of bcopy() and added more tests. 2022-04-21 08:31:22 +02:00
orbitcowboy 1fb1b22bae posix.cfg: Improved configuration for bzero() and added tests. 2022-04-20 20:57:58 +02:00
orbitcowboy fe1c1ddcc1 test/posix.c: Formatted code [ci skip]. 2022-04-20 18:21:24 +02:00
orbitcowboy d075cba535 posix.cfg: Ensure null pointer input is correctly handled for bcmp(). 2022-04-20 18:18:38 +02:00
orbitcowboy 7cbdea9b81 posix.cfg: Ensure null pointer input is correctly handled for strcasecmp(). 2022-04-20 18:15:54 +02:00
orbitcowboy a8a821a9c7 posix.cfg: Ensure null pointer input is correctly handled for strncasecmp(). 2022-04-20 18:13:49 +02:00
orbitcowboy f3fc5892e1 posix.cfg: Ensure null pointer input is correctly handled for strsep(). 2022-04-20 17:58:50 +02:00
orbitcowboy c17d3a1022 posix.cfg: Ensure null pointer input is correctly handled for stpcpy(). 2022-04-20 17:52:38 +02:00
orbitcowboy 1055b118a4 posix.cfg: Ensure null pointer input is correctly handled for gethostname(). 2022-04-20 17:40:03 +02:00
orbitcowboy d0ff2a022a posix.cfg: Added support for wcwidth(). 2022-04-20 17:32:26 +02:00
Oliver Stöneberg 4ddd7e562d
runtests.sh: refactoring and cleanups ()
* runtests.sh: avoid redundant `pkg-config` checks and simplified the check

* runtests.sh: write a message when something is completely missing

* runtests.sh: derive paths from script location

* runtests.sh: improved readability by using individual functions for each file

* runtests.sh: added helper function `get_pkg_config_cflags()` to clean up cflag lookup from `pkg-config`

* runtests.sh: simplified `xmlstarlet` calls
2022-04-20 17:27:12 +02:00
orbitcowboy 8b90b2d0fd posix.cfg: Added more tests. 2022-04-20 15:27:14 +02:00
orbitcowboy 1067cb6e5d posix.cfg: Added support for wcswidth(). 2022-04-20 15:23:46 +02:00
orbitcowboy 5be16c3113 std.cfg: Ensure null pointer input is correctly handled for fgets() and fgetws(). 2022-04-20 08:50:45 +02:00
orbitcowboy df84bed889 posix.cfg: Added support for more interfaces. 2022-04-20 07:45:38 +02:00
orbitcowboy 5a3d84d84d posix.cfg: Added support for aio_read() 2022-04-20 07:27:28 +02:00
orbitcowboy e0942c1bb4 std.cfg: Ensure warnings are issued for passing null pointer to bsearch(). 2022-04-19 21:21:35 +02:00
orbitcowboy b7bffaa1a7 Formatted code 2022-04-19 21:13:22 +02:00
orbitcowboy f3907e4c9e posix.cfg: Added support for aio_suspend(). 2022-04-19 21:13:09 +02:00
orbitcowboy 24303bfdd3 wxwidgets.cfg: Fixed FPs due to wrong direction attribute set for wxString::ToDouble and wxString::ToCDouble(). 2022-04-19 06:53:34 +02:00
orbitcowboy 6746da5e53 wxwidgets.cfg: Fixed some FPs for wxTextCtrl::GetSelection(), where the argument direction was wrongly set as input. 2022-04-18 15:41:50 +02:00
Oliver Stöneberg 8f728cb4b6
added (partial) support for specifying C++23 and support more "-std" options () 2022-04-15 16:17:36 +02:00
Paul Fultz II 28cf14f110
Fix 10975: false negative: dangling reference in class ()
* Fix 10975: false negative: dangling reference in class

* Format
2022-04-14 18:59:12 +02:00
chrchr-github 6450d5701c
Fix FP arrayIndexOutOfBoundsCond with sizeof ()
* Fix  FP constVariable with pointer typedef

* Fix flag check

* Use isStatic()

* Fix  FP arrayIndexOutOfBoundsCond with sizeof and extra parentheses
2022-04-14 18:13:29 +02:00
Paul Fultz II 6deb8068fa
Fix 10981: ValueFlow: multiplication with 0 should have known value 0 () 2022-04-14 18:13:04 +02:00
Paul Fultz II 09597bc7e8
Fix 10956: ValueFlow: Incorrect value when assigned to two variables ()
* Fix 10956: ValueFlow: Incorrect value when assigned to two variables

* Format
2022-04-14 07:35:07 +02:00
chrchr-github 7721cd14b6
Fix FP constVariable with pointer typedef ()
* Fix  FP constVariable with pointer typedef

* Fix flag check

* Use isStatic()
2022-04-13 21:56:45 +02:00
chrchr-github 8203c74c40
Fix FP sizeofDivisionMemfunc ()
* Fix  FP sizeofDivisionMemfunc when result is multiplied again with sizeof later

* Format
2022-04-13 18:21:56 +02:00
chrchr-github 938517b80a
Fix FP unused private method () 2022-04-13 14:49:28 +02:00
chrchr-github da1e2b22be
Add some tests ()
* Test for 

* Test for 

* Test for 

* Test for 

* Fix test case
2022-04-13 12:25:53 +02:00
chrchr-github f323e8a6c6
Fix FP functionConst ()
* Fix  FP functionConst

* Format

* Format
2022-04-13 12:25:36 +02:00
chrchr-github 55cb396d18
Fix Same template name confuses check () 2022-04-13 12:25:21 +02:00
chrchr-github ea65fe2b63
Fix another FP divideSizeof ()
* Fix FP divideSizeof

* Format

* Undo

* simpleMatch

* Fix another FP divideSizeof
2022-04-13 12:24:35 +02:00
Oliver Stöneberg 32978933b5
removed leftovers of generated cfg tests () 2022-04-13 12:24:17 +02:00
Oliver Stöneberg 45158ec064
cleaned up includes based on include-what-you-use ()
* cleaned up includes based on include-what-you-use

* updated translations
2022-04-13 12:24:00 +02:00
chrchr-github 5ac4afa5b8
Fix cppcheckError with spaceship operator () ()
* Fix cppcheckError with starship operator ()

* Fix test case

* Return result
2022-04-13 12:23:38 +02:00
Paul Fultz II 6c82fb05a4
Fix 10954: False positive: returnDanglingLifetime when using c_str() () 2022-04-12 08:09:13 +02:00
Paul Fultz II 61b87bcc60
Fix 10955: False positive: containerOutOfBounds when using a const reference member () 2022-04-12 08:07:55 +02:00
chrchr-github 00badff622
Fix FP functionConst ()
* Fix  FP functionConst

* Update releasenotes.txt
2022-04-11 22:55:16 +02:00
chrchr-github 28a024ac4a
Fix incorrectLogicOperator/knownConditionTrueFalse for constexpr () 2022-04-11 20:42:54 +02:00
chrchr-github bf6bcafc56
Fix FP divideSizeof () 2022-04-11 20:41:59 +02:00
Oliver Stöneberg a98346bbe0
generate a program database in all Visual Studio configurations () 2022-04-11 11:28:07 +02:00
Daniel Marjamäki 8f386e15fd Remove bug hunting. This feature will be provided in Cppcheck premium. 2022-04-11 07:31:33 +02:00
Paul Fultz II 99757c6d06
ValueFlow: Set values to parameters to escape functions ()
* ValueFlow: Set values to parameters to escape functions

* Format
2022-04-11 07:23:58 +02:00
Paul Fultz II d97942d3c6
Fix 6577: Detect pointer to uninitialised memory with clock_settime() ()
* Fix 6577: Detect pointer to uninitialised memory with clock_settime()

* Format
2022-04-11 07:23:44 +02:00
Paul Fultz II 45b4580554
Fix 10957: Crash on valid code () 2022-04-10 22:47:58 +02:00
chrchr-github bd9f5231b8
Fix FP divideSizeof with dereferenced pointer-to-pointer () 2022-04-10 22:47:27 +02:00
orbitcowboy aa7a1f25c1 Added regression test from Ticket #3929:comment18 2022-04-10 08:10:11 +02:00
chrchr-github c8936d04f6
Fix New Check : Return value of "new" ignored () 2022-04-09 19:06:32 +02:00
Oliver Stöneberg 25ef9eeb26
use std::string::empty() () 2022-04-09 19:02:37 +02:00
chrchr-github 0636018df3
Fix FP: unassignedVariable with structured binding () 2022-04-09 14:50:30 +02:00
chrchr-github 2bccde0e3b
Fix FP Logical condition considered always false () 2022-04-09 14:09:10 +02:00
chrchr-github 38bc0ad4c3
Fix regression: wrong member variable () 2022-04-08 08:23:10 +02:00
Paul Fultz II d2a0b0f78e
Fix 10951: FP knownEmptyContainer with east-const ()
* Fix 10951: FP knownEmptyContainer with east-const

* Format

* Use simpleMatch
2022-04-08 08:22:39 +02:00
chrchr-github ceb86afc22
Fix FP constStatement with cast in return () 2022-04-07 14:11:14 +02:00
Paul Fultz II 4c1aeb0cb1
Remove old pointer alias check () 2022-04-07 11:36:15 +02:00
chrchr-github 52b4aeb279
Fix FP knownConditionTrueFalse with double to int cast () 2022-04-07 10:42:57 +02:00
Paul Fultz II dad10f2ab7
Fix 7684: ValueFlow: function call 'X::GetSize()' ()
* Improve getting function to calculate the return

* Add test

* Format

* Move to cpp to avoid FP

* Format
2022-04-07 06:49:25 +02:00
Paul Fultz II 8986cf018f
Fix todo test that was using wrong function ()
* Fix todo test that was using wrong function

* Format
2022-04-07 06:48:51 +02:00
Paul Fultz II 74667d1e2a
Fix 10418: false negative: knownConditionTrueFalse ()
* Improve handling inverted condition

* Fix tests

* Rename variables for clarity

* Add initial test

* Add another test

* Format

* Fix FP
2022-04-07 06:48:13 +02:00
Paul Fultz II 09c8cfb2ae
Fix 6624: false negative: std::vector out of bounds access not detected ()
* Fix 6624: false negative: std::vector out of bounds access not detected

* Format

* Add test for auto

* Fix tests

* Format
2022-04-07 06:47:15 +02:00
Paul Fultz II bb640c4879
Fix 10950: Crash on function declaration ()
* Fix 10950: Crash on function declaration

* Format
2022-04-06 19:00:05 +02:00
chrchr-github b73aeeda0e
Fix FP constStatement with comma operator ()
* Fix FP constStatement with comma operator

* Format
2022-04-06 16:58:17 +02:00
orbitcowboy 64a7ba3c4c Added regression test for . 2022-04-06 08:12:41 +02:00
Paul Fultz II 4fde7f8b18
Fix 10449: Regression: knownConditionTrueFalse (strlen/wcslen) ()
* Refactor library function usage

* Evaluate library function in program memory

* Fix and add tests

* Format
2022-04-06 06:35:38 +02:00
Paul Fultz II 1d92665ad2
Fix 10867: false negative: containerOutOfBounds with std::array (regression) ()
* Fix 10867: false negative: containerOutOfBounds with std::array (regression)

* Format
2022-04-06 06:25:28 +02:00
chrchr-github 4c375e7224
Fix FP redundantInitialization with lambda / debug: valueFlowConditionExpressions bailout ()
* Fix  FP redundantInitialization with lambda

* Fix  debug: valueFlowConditionExpressions bailout

* Format
2022-04-05 23:19:17 +02:00
chrchr-github f5313dc519
Fix crash with defaulted destructor () 2022-04-05 23:18:08 +02:00
chrchr-github c4dcfef385
Fix debug: Executable scope 'x' with unknown function. ()
* Fix  debug: Executable scope 'x' with unknown function

* Format

* Add test for 

* Fix  debug: Executable scope 'x' with unknown function.
2022-04-05 15:52:16 +02:00
chrchr-github 3ba6914563
Add test for ()
* Fix  debug: Executable scope 'x' with unknown function

* Format

* Add test for 
2022-04-05 13:04:20 +02:00
chrchr-github cfbbeb4b1b
Partial fix for FN containerOutOfBounds with std::array ()
* Partial fix for  FN containerOutOfBounds with std::array

* Format

* Format

* Optimize
2022-04-05 07:34:20 +02:00
chrchr-github b79885c6af
Fix debug: Executable scope 'x' with unknown function ()
* Fix  debug: Executable scope 'x' with unknown function

* Format
2022-04-05 07:34:06 +02:00
chrchr-github aae810dd2c
Fix FP: duplicateValueTenary () 2022-04-04 06:33:54 +02:00
chrchr-github 955d6d8fc6
Fix internalAstError with brace-init in ternary ()
* Fix  internalAstError with brace-init in ternary

* Undo
2022-04-03 20:05:03 +02:00
Paul Fultz II 39265f8ce0
Fix 10931: Assert failure in setSymbolic() ()
* Fix 10931: Assert failure in setSymbolic()

* Format
2022-04-03 20:04:18 +02:00
Paul Fultz II 0547cbcd26
Fix 10647: FN knownConditionTrueFalse for impossible Boolean value ()
* Add impossible values for bool

* Fix valueflow tests

* Fix assertion failure

* Add test

* Format
2022-04-03 20:04:05 +02:00
chrchr-github 7a7b3e40eb
Fix regression FN constVariable with static arrays ()
* Fix regression FN constVariable with static arrays

* Fix test case
2022-04-02 20:39:45 +02:00
chrchr-github a9f29fbc09
Fix FP functionStatic with class template and east-const / FP constParameter with std::array and east-const () 2022-04-01 23:26:44 +02:00
chrchr-github 4bf8718dcb
Fix FP constStatement with pointers in lambda () 2022-04-01 19:50:40 +02:00
Paul Fultz II 5bea50cd36
Fix 10908: FP: uninitvar after for-loop () 2022-03-31 21:24:20 +02:00
chrchr-github 183969cd4b
Fix FP constStatement with extern declaration () 2022-03-31 21:08:04 +02:00
chrchr-github c85e7e7d2f
Fix FP constStatement with more complex expression () 2022-03-30 22:00:57 +02:00
Jens Yllman 34a11c1673
Fix unmatched suppression () () 2022-03-30 19:24:53 +02:00
chrchr-github 343a23135d
Fix FP constStatement with reference and direct initialization () 2022-03-30 19:22:01 +02:00
chrchr-github 47ba053054
Fix FP constVariable with static pointer () 2022-03-30 19:21:09 +02:00
chrchr-github 948bb8df94
Add test for , () 2022-03-30 15:49:45 +02:00
chrchr-github 86ff360946
Fix FP constStatement with immediately evaluated lambda () 2022-03-29 06:10:57 +02:00
chrchr-github 81bcbfa7fe
Fix FP missingOverride with friend () 2022-03-28 22:44:04 +02:00
chrchr-github 49147f95fe
Fix FP constStatement with dynamic_cast () 2022-03-28 22:15:40 +02:00
chrchr-github 8d49fc252c
Fix FP constStatement ',' with Eigen, OpenCV etc. () 2022-03-28 22:06:44 +02:00
chrchr-github 11cbb2eb00
Fix AST cyclic dependency [cppcheckError] 3 () 2022-03-28 22:05:41 +02:00
chrchr-github d57d536f01
Fix FP constStatement with negation and cast () 2022-03-28 21:52:08 +02:00
chrchr-github 7b97230dd2
Fix FP unreadVariable for lock_guard variable () 2022-03-28 21:45:49 +02:00
Paul Fultz II 54fbfd7c0f
Fix 10895: FP danglingTempReference with emplace() ()
* Fix 10895: FP danglingTempReference with emplace()

* Format
2022-03-27 10:02:30 +02:00
Paul Fultz II 21b8c36eb1
Fix 10916: FP: uninitvar () 2022-03-27 10:01:58 +02:00
chrchr-github 63d96e49fc
Fix , FP constStatement ()
* Fix ,  FP constStatement

* Fix test cases (first one did not compile)
2022-03-27 07:59:29 +02:00
chrchr-github 401f0de18b
Fix FP constStatement with new () 2022-03-27 07:59:19 +02:00
chrchr-github 1dd19dcaef
Fix AST cyclic dependency [cppcheckError] () 2022-03-26 22:39:14 +01:00
chrchr-github 5ed521622f
Fix FP constStatement with ptr to ptr to ptr ()
* Fix  FP constStatement with ptr to ptr to ptr

* simpleMatch
2022-03-26 06:12:26 +01:00
amai2012 a143fa37dd
use-retval for localtime() ()
* use-retval for localtime()

* Adjust test to avoid new warning
2022-03-25 17:32:54 +01:00
chrchr-github fe7d0eeffc
Fix FP: constStatement with template type () 2022-03-25 17:03:54 +01:00
orbitcowboy 8d7fe702e0 Ticket - Adde a regression test 2022-03-25 17:01:57 +01:00
chrchr-github 12cb19bdf2
Fix AST cyclic dependency [cppcheckError] () 2022-03-25 14:03:32 +01:00
chrchr-github e54ad24d2c
Fix FN constStatement with arrays () 2022-03-25 11:32:16 +01:00
chrchr-github 796ad6c008
Fix FP variableScope - vector referenced via iterator () 2022-03-25 09:21:17 +01:00
Daniel Marjamäki 212ac6c214 compile_commands.json: ensure that order of include paths are kept 2022-03-24 22:50:04 +01:00
chrchr-github 3630e9c49d
Fix FP constStatement with extra parentheses in declaration () 2022-03-24 22:07:21 +01:00
chrchr-github 479af21405
Fix FP uninitvar with new and braced initializer () 2022-03-24 20:08:51 +01:00
Paul Fultz II 4b4037540a
valueFlowUninit: Handle arrays and pod types ()
* valueFlowUninit: Handle arrays and pod types

* Format

* Catch another array case
2022-03-24 06:35:44 +01:00
Daniel Marjamäki 3bcbba598d Fixed (compile database: include path with space is not handled) 2022-03-23 21:13:51 +01:00
chrchr-github 0d2af9a5b7
Fix FP constStatement with init list in function call () 2022-03-23 18:10:33 +01:00
orbitcowboy d376201cb4 gnu.cfg: Added support for getpw(). Ref.: https://man7.org/linux/man-pages/man3/getpw.3.html 2022-03-23 17:14:26 +01:00
chrchr-github e0830693c3
Fix FP uninitMemberVarPrivate with anonymous union () 2022-03-23 07:35:41 +01:00
chrchr-github 39567ea8c8
Fix FP variableScope (std::for_each with lambda) () 2022-03-22 21:50:46 +01:00
chrchr-github 40c2687ac4
Fix FP constStatement with delete () 2022-03-22 18:39:02 +01:00
chrchr-github 3faff5e9fc
Fix FP knownConditionTrueFalse static variable with direct initialization () 2022-03-22 07:24:40 +01:00
chrchr-github 18a7a805df
Fix FP doubleFree () 2022-03-21 22:17:50 +01:00
Daniel Marjamäki 1fe7cd348a exename: Set proper exename when cppcheck is executed from PATH and argv[0] does not contain path information 2022-03-21 18:35:53 +01:00
chrchr-github 0e147502cc
Fix FN variableScope with enum and struct ()
* Fix  FN variableScope with enum and struct

* Scope reduction

* Scope reduction
2022-03-21 16:05:38 +01:00
chrchr-github 2baf8f6cd4
Fix FP virtualCallInConstructor with function pointer () 2022-03-19 20:00:06 +01:00
chrchr-github 297b0b5c60
Fix FP: Label 'enum' is not used. [unusedLabel] () 2022-03-17 17:38:23 +01:00
chrchr-github 97ce569859
Fix FP constStatement with extra parentheses in function call ()
* Fix  FP constStatement with extra parentheses in function call

* Format
2022-03-17 12:47:27 +01:00
chrchr-github e073860e62
Fix FN uninitMemberVar when member is being used in constructor (regression) () 2022-03-16 20:35:55 +01:00
Paul Fultz II 40ff9edad6
Fix 10843: FP: danglingTemporaryLifetime ()
* Fix 10843: FP: danglingTemporaryLifetime

* Format
2022-03-16 17:11:49 +01:00
chrchr-github fb1170b10b
Fix FP constStatement with variable called std () 2022-03-16 15:29:34 +01:00
chrchr-github b8ba0ae00e
Fix FP constStatement with ternary and comma operator () 2022-03-16 15:28:59 +01:00
Georgi D. Sotirov 33315b0ae5
Replace tinyxml2_LIBRARY with tinyxml2_LIBRARIES () 2022-03-15 21:17:03 +01:00
chrchr-github 1aff160411
Fix FP uninitvar after lambda expression ()
* Fix  FP uninitvar after lambda expression

* Format
2022-03-15 14:32:33 +01:00
chrchr-github f90a93591f
Add tests for , ()
* Add test for 

* Add test for 

* Format
2022-03-15 12:54:19 +01:00
chrchr-github 200b098471
Fix FP for unused private function if address of function is taken () 2022-03-14 19:15:48 +01:00
chrchr-github 6376bac5bb
Fix syntaxError with typedef and lambda ()
* Fix  syntaxError with typedef and lambda

* Don't insert union into template argument list, add test

* Format

* Revert "Format"

This reverts commit 8c52d49c8b.

* Format
2022-03-14 17:59:29 +01:00
chrchr-github d3d40fd599
Fix #10868/#10869 FN: constStatement, handle unused character constants ()
* Fix  FN: constStatement, handle unused character constants

* simpleMatch

* Fix  FN: constStatement

* Format
2022-03-14 14:14:32 +01:00
chrchr-github 2eed660b32
Fix Clarify warnings for uninitMemberVar () 2022-03-13 17:33:31 +01:00
chrchr-github 190506db40
Fix Regression: unusedStructMember ()
* Fix  Regression: unusedStructMember

* Add test for 

* simpleMatch
2022-03-13 06:27:17 +01:00
chrchr-github c3506b5186
Fix regressions with static variables and multiple assignments ()
* Fix regressions with static variables and multiple assignments

* Fix test

* Fix test cases
2022-03-13 06:26:21 +01:00
chrchr-github 3df170c191
Fix FN: constStatementError, streamline error messages () 2022-03-12 14:52:18 +01:00
chrchr-github d1f740a289
Partial fix for varid 0 with lambda (II) ()
* Partial fix for  varid 0 with lamba

* Format

* Undo

* Undo

* Partial fix for  varid 0 with lambda (II)
2022-03-12 06:17:37 +01:00
chrchr-github 4c85ac0d7b
Fix FP unused struct member (inner struct in C code) ()
* Fix  FP unused struct member (inner struct in C code)

* Redundant findType() call, add test
2022-03-12 06:16:29 +01:00
Paul Fultz II ff902369e0
Fix 10851: False positive: known variable value below for loop ()
* Fix 10851: False positive: known variable value below for loop

* Format

* Add test for 10863

* Format
2022-03-12 06:15:35 +01:00
chrchr-github 705931266c
constStatementError: don't warn for casts with possible side effects,… ()
* constStatementError: don't warn for casts with possible side effects, handle bool constants

* Recursive call, add tests

* Restore test

* Don't warn for C++ casts to void

* Don't warn for cast to void*
2022-03-11 21:45:51 +01:00
chrchr-github ffd9f9a93f
Fix FP missingOverride with unnamed parameters () 2022-03-11 21:44:13 +01:00
Binho 8b3647edd7 Fix false positive in memory leak 2022-03-10 08:29:05 +01:00
chrchr-github 2616046461
Partial fix for FP: unusedStructMember () 2022-03-09 20:25:58 +01:00
chrchr-github 557263acde
Partial fix for FP: unusedStructMember (II) ()
* Preliminary

* Fix member search, add tests
2022-03-09 18:22:30 +01:00
chrchr-github 850ad0fed9
: Add error message for unused casts, log unhandled errors ()
* : Add error message for unused casts, log unhandled errors

* Fix TODO

* Fix TODO
2022-03-09 18:21:47 +01:00
chrchr-github c9f47dec8b
Partial fix for varid 0 with lambda () 2022-03-08 20:10:51 +01:00
chrchr-github fbdfb60809
Warn about buffer overruns when allocating memory with new ()
* Warn about buffer overruns when allocating memory with new

* Format

* Avoid FP
2022-03-07 19:43:40 +01:00
chrchr-github 25360d5e4c
Add test for ()
* Add test for 

* Format
2022-03-07 15:32:14 +01:00
chrchr-github 461d797094
Add test for () 2022-03-07 10:44:46 +01:00
orbitcowboy 1d2beb0431 Added a regression test for ticket 6928 - Improve check: unused variables, goto 2022-03-07 10:12:57 +01:00
chrchr-github 3a5931b417
Fix C++11 default values not for all class fields and missing constructor () 2022-03-07 08:39:19 +01:00
chrchr-github 7f682d544e
Partial fix for FN buffer access out of bounds: std::vector ()
* Fix  FN: stlOutOfBounds (off by one)

* Format

* Simplify

* Partial fix for  FN buffer access out of bounds: std::vector

* Undo

* Format

* Fix test case
2022-03-06 07:41:09 +01:00
chrchr-github 0b0a8cad39
Fix FP unreadVariable within a macro (regression) ()
* Fix  FP unreadVariable within a macro (regression)

* Format

* Format
2022-03-05 08:14:57 +01:00
chrchr-github 27baa20f38
Fix FN: stlOutOfBounds (off by one) ()
* Fix  FN: stlOutOfBounds (off by one)

* Format

* Simplify
2022-03-04 17:13:13 +01:00
chrchr-github 2dd6c75b35
Fix Crash/nullptr deref in getEndOfExprScope() ()
* Fix  Crash/nullptr deref in getEndOfExprScope()

* Format
2022-03-03 17:08:23 +01:00
chrchr-github 78dd29ada3
Fix FP noConstructor with function pointer member () 2022-03-03 13:56:24 +01:00
chrchr-github 8a7992c6ac
Suppress operatorEqVarError for known non-copyable types ()
* Fix FP operatorEqVarError with class hierarchy

* Suppress operatorEqVarError for std::mutex

* Add test, non-copyable Qt types

* Update cppcheck-cfg.rng
2022-03-03 09:41:26 +01:00
Daniel Marjamäki 915ae4b845 ValueFlow: Fix crash 2022-03-02 21:12:37 +01:00
chrchr-github 9c50136571
Fix FN unreadVariable for pointer assignment when destructor exists (regression) ()
* Fix  FN unreadVariable for pointer assignment when destructor exists (regression)

* unused variable

* Issue warning for missing cfg

* Format
2022-03-02 11:11:44 +01:00
Oliver Stöneberg de728f472c
removed ThreadExecutor::addFileContent() () 2022-03-02 11:10:29 +01:00
Oliver Stöneberg 4a63af02ed
enabled functionConst and functionStatic in selfcheck ()
* fixed functionConst findings and enabled it in selfcheck

* fixed functionStatic findings and enabled it in selfcheck

* .travis_suppressions: adjusted comment

* testimportproject.cpp: added missing asserts
2022-03-02 07:46:47 +01:00
chrchr-github 8e8e6b1170
Fix FP operatorEqVarError with class hierarchy () 2022-03-02 07:46:23 +01:00
chrchr-github 01de8256ea
Fix cppcheckError with enum class and typedefs ()
* Fix  cppcheckError with enum class and typedefs

* Format

* Format

* Leave enum class scope

* Remove comment
2022-03-02 07:46:15 +01:00
chrchr-github 43fb3dd047
Fix regression: wrong varid with using namespace ()
* Fix  missing varId with using namespace

* Undo

* Fix test

* Limit namespace candidates, duplicateBranch

* rvalue ref

* Undo

* Undo

* Undo

* Format

* Fix condition

* Fix regression: wrong varid with using namespace
2022-03-02 07:46:04 +01:00
Paul Fultz II 0b310b9d07
Fix 10702: FP knownConditionTrueFalse - Member variable modified ()
* Fix 10702: FP knownConditionTrueFalse - Member variable modified

* Format

* Make parameter const

* Fix FP

* Fix FP

* Update

* Format
2022-02-28 18:54:55 +01:00
chrchr-github 6a8bd981b5
Fix CheckClass::isMemberVar found used member variable with varid 0 ()
* Fix  CheckClass::isMemberVar found used member variable with varid 0

* Restore call to simpleMatch()
2022-02-28 18:28:23 +01:00
chrchr-github 05a6d09c5f
Fix FP uninitMemberVar from copy constructor [inconclusive] () 2022-02-27 19:15:19 +01:00
chrchr-github ddb0a8bb0b
Fix missing varId with using namespace ()
* Fix  missing varId with using namespace

* Undo

* Fix test

* Limit namespace candidates, duplicateBranch

* rvalue ref

* Undo

* Undo

* Undo

* Format

* Fix condition
2022-02-27 09:03:24 +01:00
chrchr-github d79d6e60db
Fix Internal error. Token::Match called with varid 0 ()
* Fix  Internal error. Token::Match called with varid 0

* Fix test
2022-02-26 23:48:29 +01:00
chrchr-github 441b437cea
Fix FN: unusedStructMember () 2022-02-26 18:53:00 +01:00
Paul Fultz II dbc80787e1
Fix 10821: FN: containerOutOfBounds ()
* Fix 10821: FN: containerOutOfBounds

* Format

* Fix cppcheck warning

* Add valueflow tests

* Format

* Fix some bugs

* Format
2022-02-25 05:53:51 +01:00
chrchr-github f53793c413
Fix FP cstyleCast with function pointer and calling convention () 2022-02-23 09:12:14 +01:00
Oliver Stöneberg 51371f7929
added CMake option USE_THREADS to be able to use threads instead of fork() / cleanups () 2022-02-23 09:04:35 +01:00
chrchr-github 172aafdeb8
Fix FN: redundant assignment in loop () 2022-02-22 09:51:44 +01:00
Paul Fultz II 1ac16413ea
Another fix for 10800: Hang / memory exhaustion on numerical code ()
* Another fix for 10800: Hang / memory exhaustion on numerical code

* Format
2022-02-22 07:21:26 +01:00
Paul Fultz II 72d0f3e444
Fix 10808: cppcheckError AST cyclic dependency with decltype ()
* Fix 10808: cppcheckError AST cyclic dependency with decltype

* Format
2022-02-22 06:30:17 +01:00
chrchr-github 734e3ac6da
Fix cppcheckError with for loop () 2022-02-21 18:14:20 +01:00
chrchr-github bedde0a1df
Fix bug hunting; crash for small C-code () 2022-02-21 18:09:46 +01:00
chrchr-github d77fa64051
Fix Function::addArguments found argument 'x' with varid 0 () 2022-02-21 18:06:26 +01:00
chrchr-github 5574e41b86
Fix CheckClass::isMemberVar found used member variable with varid 0 () 2022-02-20 18:17:47 +01:00
chrchr-github 18e00bb4fd
Fix Crash in checkPassByReference() / Stack overflow with decltype / Crash on invalid code ()
* Fix  Crash in checkPassByReference()

* Format

* Fix  Stack overflow with decltype

* Fix  Crash on invalid code in TemplateSimplifier::templateParameters
2022-02-18 12:59:21 +01:00
chrchr-github 6635e6cc07
Fix cppcheckError with for loop () 2022-02-17 22:12:19 +01:00
chrchr-github 2f46e57311
Add leak-ignore for fopen_s(), test cases ()
* Add leak-ignore for fopen_s(), test cases

* Format
2022-02-17 16:22:30 +01:00
chrchr-github a1adbff683
Fix FN Memory leak not detected when variable is 'used' by allocation function in condition () 2022-02-16 21:31:24 +01:00
chrchr-github b07814f329
Fix FN missed class members in copy operator of derived class () 2022-02-16 21:30:19 +01:00
chrchr-github 6488cb6e76
Add test for () 2022-02-16 16:43:06 +01:00
Daniel Marjamäki c968aeaf73 Import project: do not crash when importing compile database generated by IAR workbench 2022-02-16 08:35:47 +01:00
chrchr-github 9582032906
Fix FP uninitMemberVar - ctor calls function with smart pointer argument () 2022-02-16 07:02:26 +01:00
chrchr-github 52f549fa87
Fix crash on garbage code () 2022-02-15 20:19:03 +01:00
chrchr-github 907218254e
Fix previous commit ()
* Fix  unsafeClassCanLeak missing for array of pointers

*  Fix previous commit

* Format

* Format
2022-02-15 20:03:02 +01:00
chrchr-github e7e2439347
Fix unsafeClassCanLeak missing for array of pointers () 2022-02-15 14:28:19 +01:00
chrchr-github a5674182bb
Add test for () 2022-02-15 12:52:10 +01:00
orbitcowboy d131235a53 test windows.cfg: Added regression test for _wtoi_l and _atoi_l. 2022-02-15 11:37:10 +01:00
Daniel Marjamäki f2420509c9 Revert "constPointer: Fix false positives when pointer is not read"
This reverts commit 6427b4888b.

If variable/parameter is unused it is better to warn about that.
2022-02-13 08:40:45 +01:00
Daniel Marjamäki 6427b4888b constPointer: Fix false positives when pointer is not read 2022-02-12 22:23:25 +01:00
chrchr-github 0a99e3b6fc
Partial fix for FN redundant assignment/unreadVariable () 2022-02-12 15:32:08 +01:00
Daniel Marjamäki 30cec97cc8 Tokenizer: Support C++20 default bit-field member initializer 2022-02-12 12:19:08 +01:00
chrchr-github edc5106237
Fix FN missingOverride - subclass in namespace () 2022-02-12 08:19:07 +01:00
chrchr-github c5ab936088
Fix FN shadowVariable in range-based for loop () 2022-02-12 08:10:53 +01:00
Rikard Falkeborn d4cd249c21
10671 fix const iterator function const take two ()
* Revert "Revert "Fix : functionConst FN with begin/end and const_iterator ()""

This reverts commit 9f6a36c1a8.

* Fix crash by adding missing null check
2022-02-11 21:23:23 +01:00
chrchr-github 5f3ddabd56
Fix FP constParameter with std::map () 2022-02-11 19:40:11 +01:00
Paul Fultz II 78228599da
Fix 10800: Hang / memory exhaustion on numerical code ()
* Fix 10800: Hang / memory exhaustion on numerical code

* Format

* Add another test

* Format
2022-02-11 06:52:28 +01:00
Oliver Stöneberg f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly () 2022-02-10 23:02:24 +01:00
Julien Marrec 2535bf984b
Allow passing std::string_view by value () 2022-02-10 21:01:12 +01:00
chrchr-github cd7532df21
Fix FN C-style pointer casting with built-in or typedef types /… () 2022-02-10 20:48:51 +01:00
Paul Fultz II 5d25050b06
Fix 10788: False positive: zerodivcond when using an assert () 2022-02-10 20:22:14 +01:00
chrchr-github ddd84f9b98
Add tests/TODO for , ()
* Add tests/TODO for , 

* Comment
2022-02-10 20:05:14 +01:00
orbitcowboy 65c0ef8eb0 Added a regression test for ticket . 2022-02-10 14:13:50 +01:00
chrchr-github 24e9859158
Fix FP stlcstrParam due to incorrect overload resolution ()
* Fix  FP stlcstrParam due to incorrect overload resolution

* Variable shadowing
2022-02-10 11:17:06 +01:00
Paul Fultz II a50452517d
Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState() ()
* Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState()

* Format
2022-02-10 07:43:27 +01:00
orbitcowboy 09da69b1c7 posix.cfg: Added support for 'llseek()', which is obsolescent since glibc version 2.28 2022-02-09 08:34:35 +01:00
chrchr-github 2c7948102a
Fix FP AssignmentAddressToInteger with enum class () 2022-02-08 16:12:35 +01:00
chrchr-github e64ea20089
Fix FP variableScope for if with init-statement () 2022-02-08 16:12:09 +01:00
chrchr-github 966dbb1990
Windows.cfg: add UNREFERENCED_PARAMETER() macro () 2022-02-08 11:50:28 +01:00
Paul Fultz II 20a5224d7e
Fix 10784: False positive: returnDanglingLifetime using std::tie with variadic template parameters () 2022-02-08 09:03:51 +01:00
Paul Fultz II 260d155bb6
Fix 10785: False positive: constParameter when using member pointer () 2022-02-07 18:45:32 +01:00
orbitcowboy c983151b9c posix.cfg: Added support for lseek64(). 2022-02-07 14:15:48 +01:00
orbitcowboy bd1d8ea7b8 posix.cfg: Improved configuration of lseek(). 2022-02-07 13:58:38 +01:00
orbitcowboy 2dea968ec5 windows.cfg: Improved configuration of _fseeki64() 2022-02-07 09:12:31 +01:00
orbitcowboy a7b7b46d76 posix.cfg: Improved configuration of fseeko()/fseeko64(). 2022-02-07 09:03:39 +01:00
orbitcowboy 2f17147900 std.cfg: Improved configuration for fseek(). The 3rd argument is not allowed to be of Boolean type. 2022-02-07 09:02:24 +01:00
Paul Fultz II 569332a50a
Fix 10786: False positive: arrayIndexOutOfBoundsCond () 2022-02-06 20:14:13 +01:00
Paul Fultz II a639c59780
Fix 10787: False positive: knownConditionTrueFalse with a conditional exit () 2022-02-06 20:13:44 +01:00
orbitcowboy fa776051e9 Fixed Ticket 1001 - std.cfg: Invalid parameters for fseek() 2022-02-06 16:05:14 +01:00
Oliver Stöneberg 974dd5d49f
only use bundled tinyxml2 in CMake when configured to do so () 2022-02-06 13:02:52 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
chrchr-github 7f28edbe26
Fix Crash in CheckMemoryLeakInClass () 2022-02-04 19:32:23 +01:00
orbitcowboy 31ea13eb0c test std.cfg: Fixed wrong npos constant. 2022-02-04 12:39:43 +01:00
orbitcowboy 7062b0a973 std.cfg: Improved configuration of std::[w]string::substr(). Do not allow negative length arguments. 2022-02-04 12:30:37 +01:00
chrchr-github 17b538210d
Fix FP eraseDereference when returning iterator from loop () 2022-02-03 21:13:48 +01:00
Daniel Marjamäki 9f6a36c1a8 Revert "Fix : functionConst FN with begin/end and const_iterator ()"
This reverts commit 2cacb13f85.
2022-02-03 11:04:02 +01:00
chrchr-github a20465eaea
Fix FP knownConditionTrueFalse with static variable and direct initialization / partial fix for () 2022-02-02 22:30:49 +01:00
chrchr-github 511520d623
Fix FP constParameter with const/nonconst overload () 2022-02-02 19:38:32 +01:00
Rikard Falkeborn 2cacb13f85
Fix : functionConst FN with begin/end and const_iterator ()
Check if the iterator is assigned to a const_iterator or
const_revese_iterator, in which case it is possible the function can be
const. Unfortunately, it is not possible to remove the hard coding of
cbegin, cend, crbegin and crend due to the need to handle auto, as in
the following code snippet:

    void cbegin_auto(void)
    {
        for (auto it = m_str.cbegin(); it != m_str.cend(); ++it) {;}
    }
2022-02-02 19:37:06 +01:00
chrchr-github dad64bfcc8
Fix FP shadowFunction with default destructor implementation / Tests for , , , , () 2022-02-02 19:30:49 +01:00
chrchr-github 69ee464dff
Fix test for () 2022-02-02 19:29:01 +01:00
chrchr-github 8cf5c8fbf2
Fix FP unusedStructMember with static object () 2022-02-02 19:28:16 +01:00
chrchr-github 94a1f76ec4
Fix 10158 FP memleak when pointer is stored in a sub-object () 2022-02-02 13:13:12 +01:00
chrchr-github 2b13a27140
Fix FP uninitdata - writing pointer to stream () 2022-02-02 12:24:32 +01:00
shaneasd 4127885282
improve noConstructor message () 2022-02-01 17:24:26 +01:00
Oliver Stöneberg 8f7770f512
added an include-what-you-use GitHub Action () 2022-02-01 17:19:19 +01:00
chrchr-github 0807924d32
Fix FP passedByValue for unions / FN passedByValue for array members () 2022-02-01 17:17:08 +01:00
chrchr-github 127b3bb1c4
Fix FP unreadVariable caused by invalid template injection () 2022-02-01 17:15:27 +01:00
Daniel Marjamäki 637aca8d59 Fixed (False positive: shadow variable in static method) 2022-01-28 16:03:06 +01:00
chrchr-github d55010c441
Fix FP uninitMemberVar (inconclusive) () 2022-01-28 15:05:13 +01:00
chrchr-github c74eeb6bad
Fix FN uninitVar with std::array () 2022-01-27 19:45:27 +01:00
chrchr-github f429245da2
Fix FP format string requires unsigned long (for sizeof(var)) () 2022-01-27 19:43:52 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use () 2022-01-27 19:03:20 +01:00
Paul Fultz II 40147c1e4b
Fix 10719: Crash in valueFlowIterators() ()
* Fix 10719: Crash in valueFlowIterators()

* Format
2022-01-26 06:42:41 +01:00
Paul Fultz II 1a949c00b0
Fix 10723: Assertion 'tok && tok->exprId() > 0 && "Missing expr id for symbolic value"' in valueFlowSmartPointer() ()
* Fix 10723:  Assertion 'tok && tok->exprId() > 0 && "Missing expr id for symbolic value"' in valueFlowSmartPointer()

* Format
2022-01-26 06:28:13 +01:00
chrchr-github c132235a76
Add test for ()
* Fix  False positive: uninitStructMember

* Fix  False positive: unreadVariable alias

* Use Token::Match

* Add test for 
2022-01-25 22:05:54 +01:00
orbitcowboy cf6d30f358 Merge branch 'main' of https://github.com/danmar/cppcheck into main 2022-01-25 13:08:25 +01:00
orbitcowboy 00997283cb Code formatting 2022-01-25 13:08:05 +01:00
chrchr-github f49cfcd23c
Fix False positive: uninitStructMember () 2022-01-25 12:14:20 +01:00
chrchr-github ea81ce933e
Fix FP invalidFunctionArg with resize() () 2022-01-25 12:13:49 +01:00
chrchr-github d05e43ce15
Fix False positive: unreadVariable alias () 2022-01-24 21:52:45 +01:00
chrchr-github 9d6e5c2a05
Fix uninitMemberVar - member initialized via function call () 2022-01-24 21:52:00 +01:00
chrchr-github 158f3d494e
Fix false positive: redundantInitialization with std::shared_ptr () 2022-01-24 21:50:50 +01:00
chrchr-github d64dadcd31
Fix Crash in CheckClass::checkConstFunc() () 2022-01-24 21:50:01 +01:00
chrchr-github b491fcc489
Add test cases for , () 2022-01-24 15:06:40 +01:00
Paul Fultz II 01e14a12f1
Fix 10755: Assertion "!maxValue->isKnown()" from valueFlowInferCondition ()
* Fix 10755: Assertion "!maxValue->isKnown()" from valueFlowInferCondition

* Format
2022-01-22 12:25:20 +01:00
Paul Fultz II 8b1ed9cbe1
Another fix for 10739: internalAstError with decltype ()
* Another fix for 10739: internalAstError with decltype

* Format
2022-01-22 07:22:57 +01:00
chrchr-github b23ca879ed
Fix FP functionConst with overloaded operator[] [inconclusive] () 2022-01-21 20:40:10 +01:00
Paul Fultz II a7dbd288c4
Fix 10738: FP knownEmptyContainer with auto reference ()
* Fix 10738: FP knownEmptyContainer with auto reference

* Format
2022-01-21 09:56:55 +01:00
Paul Fultz II 6c2b1f093d
Another fix for 10728: Crash in CheckStl::checkDereferenceInvalidIterator2() ()
* Another fix for 10728: Crash in CheckStl::checkDereferenceInvalidIterator2()

* Format
2022-01-21 09:56:41 +01:00
Paul Fultz II 0737cc4d8c
Fix 10708: Assertion "!maxValue->isKnown()" from valueFlowInferCondition ()
* Fix 10708: Assertion "!maxValue->isKnown()" from valueFlowInferCondition

* Format
2022-01-21 09:56:24 +01:00
Paul Fultz II 57b50e4b00
Fix 10739: internalAstError with decltype () 2022-01-20 21:36:48 +01:00
chrchr-github 7f9ef8c321
Add test cases for , , ()
* Add test case for  and 

* Add test case for ##9256
2022-01-20 16:15:38 +01:00
chrchr-github 4d44d0c079
Fix FP deallocuse after auto_ptr () 2022-01-19 21:39:45 +01:00
chrchr-github 089ca67d78
Use TODO_ASSERT () 2022-01-18 22:03:52 +01:00
Oliver Stöneberg 55ff684f34
added unusedFunction self check to CI / cleanups () 2022-01-18 22:02:25 +01:00
Rikard Falkeborn e106654993
Fix : Uncaughty exception in CheckMemoryLeak::getReallocationType() () 2022-01-18 20:50:06 +01:00
chrchr-github 1e2863cd33
Fix FP functionConst with aggregate initialization [inconclusive] () 2022-01-18 20:49:35 +01:00
chrchr-github ca2e0ca287
Fix FP functionConst with extra parentheses () 2022-01-18 20:21:25 +01:00
chrchr-github cb5a50c6a7
Fix FN passedByValue with QString () 2022-01-18 20:17:05 +01:00
Paul Fultz II 7b793af451
Fix 10728: Crash in CheckStl::checkDereferenceInvalidIterator2 ()
* Fix 10728: Crash in CheckStl::checkDereferenceInvalidIterator2

* Format
2022-01-18 14:48:02 +01:00
orbitcowboy b6c010c17e Added regression test for Ticket 7981. 2022-01-18 13:09:02 +01:00
chrchr-github c2fc4973ad
Fix False positive for explicit one-argument constructor if co… () 2022-01-17 20:51:23 +01:00
chrchr-github 9c56e7ea8d
Fix FN uninitialized variable usage not detected () 2022-01-17 20:35:30 +01:00
chrchr-github 605fd7cf98
Fix FP functionConst (inconclusive) with nested members () 2022-01-17 20:33:32 +01:00
Paul Fultz II 7406dd8c94
Fix 10721: Crash in Tokenizer::simplifyTokenList1 () 2022-01-16 12:46:20 +01:00
Paul Fultz II abb0563cef
Fix 10726: Crash in CheckExceptionSafety::checkRethrowCopy () 2022-01-16 12:35:51 +01:00
Paul Fultz II 89bc226738
Fix 10718: Crash in CheckOther::checkDuplicateExpression () 2022-01-16 12:34:20 +01:00
Paul Fultz II 4af98f21d6
Fix 10588: crash () 2022-01-16 12:33:31 +01:00
Paul Fultz II 9220c8175d
Remove todo assert () 2022-01-16 12:32:46 +01:00
Paul Fultz II 55ff010df3
Fix 10717: Crash in SymbolDatabase::setValueTypeInTokenList ()
* Fix 10717: Crash in SymbolDatabase::setValueTypeInTokenList

* Format
2022-01-15 07:56:56 +01:00
Paul Fultz II 0b1cd8626d
Fix 10664: Crash in Token::linkAt ()
* Fix 10664: Crash in Token::linkAt

* Format
2022-01-14 23:51:01 +01:00
Paul Fultz II 2b6a89e30e
Fix 10716: Crash in CheckStl::checkDereferenceInvalidIterator2 ()
* Fix 10716: Crash in CheckStl::checkDereferenceInvalidIterator2

* Format
2022-01-14 23:50:33 +01:00
chrchr-github 781a145680
Fix regression: functionStatic related to overload resolution () 2022-01-14 17:55:50 +01:00
chrchr-github 12abf85d1d
Add test case for , use TODO_ASSERT, enable test case ()
* Add test case for , use TODO_ASSERT, enable test case

* Comment
2022-01-13 19:52:02 +01:00
Armin Müller 5a05631c84
Typos found by running "codespell" () 2022-01-13 17:24:26 +01:00
chrchr-github 95dc05b21d
Fix false negative: (style) Unused variable: std::pair () 2022-01-13 08:05:05 +01:00
chrchr-github af0a585a70
Partial fix for False negative: stlOutOfBounds, cast () 2022-01-13 08:03:24 +01:00
Maurice Gilden 44b182c9a7
Improve definitions for googletest ASSERT_* macros ()
This avoids assertWithSideEffect and follows more closely what the real macros
are doing, similar to the ones in boost.cfg and cppunit.cfg.
2022-01-12 22:09:17 +01:00
chrchr-github 7aa0ec3e95
Fix regression: unreadVariable for trivial initialization () 2022-01-12 22:06:03 +01:00
chrchr-github 1b89c998f5
Fix FP returnTempReference with overloaded operator+= () 2022-01-12 22:05:30 +01:00
Paul Fultz II fa651272f0
Fix 10001: Syntax error on valid C++ code () 2022-01-12 22:04:28 +01:00
chrchr-github e4c8798974
Fix FP containerOutOfBounds with QList [inconclusive] () 2022-01-12 22:03:57 +01:00
chrchr-github 1670805a8d
Fix FP unreadVariable with std::shared_lock () 2022-01-10 07:43:02 +01:00
chrchr-github df3da38483
Fix Unused QString / unused std::array / unused variable with c++11 braced initializer not detected () 2022-01-10 07:36:49 +01:00
Paul Fultz II 4ef20f8f1e
Fix 10683: FP danglingTemporaryLifetime with pointer to vector () 2022-01-10 07:34:26 +01:00
Paul Fultz II fe7595cd9d
Fix 10677: crash during valueFlowInferCondition () 2022-01-09 22:43:08 +01:00
orbitcowboy 4a3a287248 Improved test case for ticket 1586 2022-01-08 18:39:19 +01:00
orbitcowboy 89e60af516 Ticket - Added regression test 2022-01-08 17:45:45 +01:00
Paul Fultz II 0c9eb5d190
Fix 10681: FP ctuuninitvar with array member () 2022-01-08 10:47:28 +01:00
chrchr-github 635c09643d
Add tests for , () 2022-01-07 12:34:57 +01:00
shaneasd 8f7996211b
remove nullScope from TestSymbolDatabase () 2022-01-06 15:23:43 +01:00
chrchr-github 9fda86eb6d
Fix () 2022-01-06 15:21:05 +01:00
chrchr-github 6c55f9cf88
Add test for () 2022-01-06 15:19:10 +01:00
Paul Fultz II 1682344a80
Fix 10678: FP nullPointerArithmeticRedundantCheck in while loop () 2022-01-04 21:19:45 +01:00
chrchr-github fe077fc141
Add test for () 2022-01-04 20:50:00 +01:00
Oliver Stöneberg 0ba9cb4e64
fixed some unusedFunction warnings () 2022-01-04 15:48:08 +01:00
chrchr-github c05e2cc6c4
Fix False positive: objectIndex () 2022-01-04 10:37:16 +01:00
Paul Fultz II 119ec0582a
Fix 10676: FP: Array index -1 is out of bounds. () 2022-01-04 10:21:54 +01:00
Daniel Marjamäki 3524a0a3eb exprengine: reduce max buffer size to int_max 2022-01-03 20:55:46 +01:00
Daniel Marjamäki 33305ef4ec exprengine: better checking for uninit variables 2022-01-03 12:47:13 +01:00
Oliver Stöneberg 6739995e79
removed or annotated some code which is only used in test code () 2022-01-03 12:40:20 +01:00
Paul Fultz II 01a8890d6d
Fix 9760: False positive: constParameter on parameter used to take non-const pointer via array decaying () 2022-01-02 08:15:38 +01:00