10075 Commits

Author SHA1 Message Date
Daniel Marjamäki
33557012a1
Merge pull request #2706 from rikardfalkeborn/condition-fn-with-sizeof
Fix FN with known condition and sizeof
2020-07-13 20:54:25 +02:00
Daniel Marjamäki
cb221e970d Bug hunting: Add test case for CVE-2019-12977. Passing uninitialized struct to function 2020-07-13 20:42:53 +02:00
Daniel Marjamäki
8ba714373f
Merge pull request #2704 from rikardfalkeborn/9635-memleak-with-comma-operator-in-if-statement
Fix #9635 (FP: Memory leak with comma operator in if-statement)
2020-07-13 20:08:57 +02:00
Daniel Marjamäki
4465d033f6 Bug hunting; When passing uninitialized data to unknown function it is inconclusive if that would be a problem for the function or not 2020-07-13 11:43:11 +02:00
Daniel Marjamäki
0009b4c8af test/bug-hunting/cve.py: Add --slow argument to check slow packages 2020-07-13 11:18:51 +02:00
Rikard Falkeborn
d8e7e9176b Fix FN with known condition and sizeof
cppcheck behaved differently if sizeof was to the left or right of the
comparison. In order to fix this, we cannot break the while loop until
all operands have been processed.
2020-07-10 23:39:16 +02:00
Daniel Marjamäki
27841d6b81 Fixed #9795 (False positive: Local lock is not ineffective, mutex is locked in thread also.) 2020-07-10 19:24:45 +02:00
Rikard Falkeborn
1e679cc5d1 Fix #9635 (FP: Memory leak with comma operator in if-statement)
When checking for comparisons in if-statements, if there are comma
operators in the if-statement, skip until after the last comma.
2020-07-09 21:31:43 +02:00
Daniel Marjamäki
0c6aabe444
Merge pull request #2703 from rikardfalkeborn/9652-fp-function-call-cast-config
Fix #9652 (fp memleak with function call with cast)
2020-07-08 15:10:41 +02:00
Rikard Falkeborn
4996ec190e Fix #9652 (fp memleak with function call with cast)
When the first argument was (void *)(1), at the start of the second
iteration, arg was pointing to the "1", which caused problems for
nextArgument(), which saw the ")" as the next token and returned
nullptr, signalling that there are no more arguments.

Instead, save the first token in the argument, which makes
nextArgument() do the right thing.
2020-07-08 00:02:39 +02:00
Rikard Falkeborn
d5345052ab Fix #9793 (false positive, memleak with lambda)
Skip scopes with lambdas (similar to how checkleakautovar does). In
order to fix this when the lambda is inside a for loop, make
hasInlineOrLambdaFunction() recursive. This should be what all existing
users want.
2020-07-07 21:51:36 +02:00
Daniel Marjamäki
921997c9e9 itc.py; false negative is fixed 2020-07-03 17:50:56 +02:00
orbitcowboy
cabafca5ae windows.cfg: Added some constants from WinUser.h 2020-07-01 16:14:59 +02:00
Daniel Marjamäki
d2b2bae7bf Fixed #7733 (False positive: scope of the variable can be reduced (variable is used in hidden code)) 2020-07-01 08:24:52 +02:00
Daniel Marjamäki
f56a17bf3d Fixed #8858 (FP: identicalConditionAfterEarlyExit when there is #if) 2020-07-01 07:48:32 +02:00
Daniel Marjamäki
0583763cc6 Fixed #3088 (False positive: Dont report "struct or union member is never used" for structs with __attribute__((packed)) or #pragma pack(push)) 2020-06-30 11:00:40 +02:00
Paul
07d8cb4f01 Extend scope of afterCondition until end of function 2020-06-29 11:55:59 -05:00
Daniel Marjamäki
a49d277e0d Fixed #6471 (FP functionConst - member function modifying member variable after cast (inconclusive)) 2020-06-29 13:09:01 +02:00
Daniel Marjamäki
ad5e4fef1f Bug hunting; improved handling of 'malloc' in uninit checker 2020-06-28 21:20:59 +02:00
Daniel Marjamäki
6c588cc3ef Library: Refactoring <alloc> init attribute 2020-06-28 21:01:43 +02:00
Daniel Marjamäki
d4bd3016da ExprEngine; Improved handling of for loop, loop variable 2020-06-28 17:28:40 +02:00
Daniel Marjamäki
c42c751d61 ExprEngine; Fixed testing 2020-06-28 13:41:27 +02:00
Daniel Marjamäki
e1704f2b50 Bug hunting; fix juliet test cases error id 2020-06-28 08:16:46 +02:00
Daniel Marjamäki
bcaf792e30 Bug hunting; Fix FP for struct with uninitialized members passed to function in C 2020-06-27 22:11:12 +02:00
Daniel Marjamäki
d353a4ecba ExprEngine; copy Data => copy arrays 2020-06-27 18:09:43 +02:00
Daniel Marjamäki
e6aa96d90f Bug hunting; Improved uninit checking 2020-06-27 14:59:02 +02:00
Daniel Marjamäki
e19ef6ac62 Bug hunting; Improved uninit checking for function calls with constant parameter 2020-06-27 14:15:53 +02:00
Daniel Marjamäki
ff5a717fc6 Bug hunting; Avoid false positives for const parameter data 2020-06-27 12:17:11 +02:00
Daniel Marjamäki
b09bcdc38c Use ValueFlow for compareBoolExpressionWithInt 2020-06-27 08:13:22 +02:00
Daniel Marjamäki
1ad70bbeb8
Merge pull request #2697 from pfultz2/unique_lock
Extend mutex checking for more locking patterns
2020-06-27 07:32:26 +02:00
Daniel Marjamäki
c3749625f3
Merge pull request #2688 from jpyllman/fix_chklibfunc
not report locally declared functions as missing configuration of --check-library
2020-06-27 06:53:09 +02:00
Daniel Marjamäki
72bdeb9307
Merge pull request #2698 from pfultz2/const-param-casts
Fix issue 9778: False positive: constParameter when returning non-const reference cast
2020-06-27 06:45:30 +02:00
Paul
cf475fab51 Fix issue 9778: False positive: constParameter when returning non-const reference cast 2020-06-26 15:47:59 -05:00
Daniel Marjamäki
f5ace9ffbe SymbolDatabase; Improved ValueType when container methods items 2020-06-26 22:47:28 +02:00
Paul
82b91869ee Extend mutex checking for more locking patterns 2020-06-26 15:06:20 -05:00
orbitcowboy
b33326bf51 windows.cfg: Added a regression test for GetSystemInfo that ensure no uninitvar-FP is shown. 2020-06-26 20:45:18 +02:00
Daniel Marjamäki
cb8396aaf8
Merge pull request #2696 from pfultz2/getTokenArgumentFunction-ast
Fix issue 9710 and 9767: Use AST to get function from argument
2020-06-26 09:50:18 +02:00
Daniel Marjamäki
af6e76d623 Fixed #9787 (Better handling of user defined literals) 2020-06-25 22:06:34 +02:00
Paul
1676ad5f45 Fix issue 9710 and 9767: Use AST to get function from argument 2020-06-25 12:54:46 -05:00
Daniel Marjamäki
ec8fbb1580
Merge pull request #2682 from pfultz2/check-mutexes
Add new check for incorrect usage of mutexes and lock guards
2020-06-25 16:21:36 +02:00
Paul
3c10a9c659 Update message 2020-06-24 18:09:30 -05:00
Jens Yllman
a87686911a one more test updated for the new checkLibraryFunction 2020-06-23 09:06:54 +02:00
Daniel Marjamäki
9b5986505e AST; Improved ast for variable declaration with assignment 2020-06-22 08:34:31 +02:00
Daniel Marjamäki
f792cabc2b ExprEngine; better handling of containers 2020-06-21 21:48:36 +02:00
Daniel Marjamäki
5497e8ed67 ExprEngine; Improved handling of stream read 2020-06-21 20:05:26 +02:00
Daniel Marjamäki
8ec5605bac
Merge pull request #2689 from Ken-Patrick/9769
9769: Improve value flow for ternary operator
2020-06-21 13:04:43 +02:00
Daniel Marjamäki
f270ca1909 ExprEngine; Better handling of function calls 2020-06-20 23:00:39 +02:00
Ken-Patrick Lehrmann
5a3789a23f 9769: Improve value flow for ternary operator
In some cases, the condition of the ternary operator is assigned a known
value after the two possible results, and in such cases, we would not
take the opportunity to assign a value to the ternary operator (and to
the other parents in the ast).
This patch adds this capability.
2020-06-20 10:29:28 +02:00
Jens Yllman
aa380e0de1 fix a test that was suppressed because #9002 2020-06-19 23:04:15 +02:00
Daniel Marjamäki
af45148e58 ExprEngine; Refactor and improve code. Add tests for increments. 2020-06-19 20:40:20 +02:00