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
Daniel Marjamäki
06aeac75dc
Bug hunting; Fix false negatives
2020-06-19 18:38:02 +02:00
Daniel Marjamäki
6ec15b6d7b
ExprEngine; Simple handling of increment/decrement
2020-06-19 17:35:35 +02:00
Daniel Marjamäki
f516bde744
ExprEngine; Fix TODO assertion
2020-06-19 14:05:19 +02:00
Daniel Marjamäki
ab663feea8
Add testbughuntingchecks.cpp
2020-06-19 13:38:56 +02:00
Daniel Marjamäki
d0ac583b97
Add 'bughuntingchecks'
2020-06-19 13:16:48 +02:00
Daniel Marjamäki
d3df68e376
Updated bug hunting test
2020-06-18 14:31:51 +02:00
Paul
f7029e62ac
Check for mor FPs
2020-06-17 17:06:06 -05:00
Daniel Marjamäki
3f8218af1b
Removed CheckClass::operatorEq: does not 'belong'
2020-06-17 20:35:43 +02:00
Ken-Patrick Lehrmann
c297ed8204
Better handle noreturn or throwing functions in valueflow
...
Teaching cppcheck about `BOOST_THROW_EXCEPTION` and
`boost::throw_exception`, and using noreturn information from libraries
in value flow.
This fixes false positive nullPointerRedundantCheck with the following
code:
```
void throwexception(int * buf)
{
if (!buf)
boost::throw_exception(std::bad_alloc());
*buf = 0;
}
```
2020-06-17 19:06:14 +02:00
Paul
21f76d62a1
Merge branch 'main' into check-mutexes
2020-06-17 10:45:43 -05:00
Daniel Marjamäki
51a6af299f
Merge pull request #2683 from Ken-Patrick/cast_expandTemplate
...
Fix handling of c++ casts in template expansion
2020-06-17 09:21:01 +02:00
Daniel Marjamäki
94f92f00fe
Merge pull request #2684 from firewave/precompiled
...
use precompiled headers if CMake supports it
2020-06-17 07:53:51 +02:00
Daniel Marjamäki
4947a3b7ab
Bug hunting; review and improve handling of multi dimensional arrays
2020-06-16 22:50:45 +02:00
firewave
a49d60f0b3
use precompiled headers if CMake supports it
2020-06-16 19:56:53 +02:00
Ken-Patrick Lehrmann
5c1a2db434
Fix handling of c++ casts in template expansion
...
Cast were not expanded properly: the `<` was not taken into account in
typeindentlevel, so we would then miss a `>`, resulting in syntaxError.
2020-06-16 19:36:04 +02:00
Paul
18225ee27e
Update text and change to warnings
2020-06-16 10:32:39 -05:00
Paul
172537807b
Add check for incorrect usage of mutexes and lock guards
2020-06-15 19:40:54 -05:00
Daniel Marjamäki
6faad9cd90
Bug hunting; better handling when assigning multidimensional array in for loop
2020-06-15 22:42:45 +02:00
Daniel Marjamäki
f5fe5ca2dd
9768: Fix ast with throw in the middle of return ( #2678 )
...
* 9768: Fix ast with throw in the middle of return
```
int f(bool x)
{
return x ? 0 : throw 0;
}
```
The `throw` part was not included in the ast, leading to an invalid
ternary operator.
* 8526: Fix ast construction for ternary operator
This tries to decide a bit more properly when ':' can be part of a
ternary operator. More precisely, there are some times when we want to
delay the construction of the ast for ':', so that it is place
accordingly to the matching '?'.
Typically, this fixes an issue with
`return val < 0 ? throw 1 : val;`,
where the ast for ':' would be constructed during as part of the
`throw`, and the ast for `?` would be invalid.
This patch is a bit of a hardcode, stating that we don't expect ':'
inside a throw, unless there is a complete ternary operator in there
(there can't be a range based for loop, a case in a switch). When we
reach ':', we know we are and the end of the `throw`.
2020-06-15 10:36:02 +02:00
Daniel Marjamäki
3fe2b6fe50
Update test. An inconclusive warning message is now shown.
2020-06-14 22:57:50 +02:00
Daniel Marjamäki
2b0e4926bc
valueFlowAfterAssign: variable initialization
2020-06-14 21:14:05 +02:00
Ken-Patrick Lehrmann
7ddb7aef7d
8526: Fix ast construction for ternary operator
...
This tries to decide a bit more properly when ':' can be part of a
ternary operator. More precisely, there are some times when we want to
delay the construction of the ast for ':', so that it is place
accordingly to the matching '?'.
Typically, this fixes an issue with
`return val < 0 ? throw 1 : val;`,
where the ast for ':' would be constructed during as part of the
`throw`, and the ast for `?` would be invalid.
This patch is a bit of a hardcode, stating that we don't expect ':'
inside a throw, unless there is a complete ternary operator in there
(there can't be a range based for loop, a case in a switch). When we
reach ':', we know we are and the end of the `throw`.
2020-06-14 18:57:18 +02:00
Ken-Patrick Lehrmann
4023a487ff
9768: Fix ast with throw in the middle of return
...
```
int f(bool x)
{
return x ? 0 : throw 0;
}
```
The `throw` part was not included in the ast, leading to an invalid
ternary operator.
2020-06-14 14:49:10 +02:00
Daniel Marjamäki
37245a8179
Update copyright year
2020-06-13 16:37:12 +02:00
Paul Fultz II
06ed088bd0
Fix issue 9751: Wrong lifetime caused by std::function ( #2676 )
2020-06-13 10:26:54 +02:00
Paul Fultz II
03b41ac987
Fix issue 9718: False positive: Parameter can be declared const when written to via stream extraction operator ( #2677 )
2020-06-13 09:20:40 +02:00
orbitcowboy
258d0a6ade
Running astyle [ci skip].
2020-06-12 16:08:40 +02:00
orbitcowboy
9f445fc735
Library: simplified code and added test cases for validating <valid>-tag expressions
2020-06-12 16:06:43 +02:00
orbitcowboy
05c36a79b5
Fix testrunner fail, introduced by latest commit
2020-06-12 09:18:16 +02:00
orbitcowboy
a3d58a9302
std.cfg: Allow scientific floating point notation for '<valid>'-tags
2020-06-12 08:51:33 +02:00
orbitcowboy
e767bb8ff3
std.cfg: Added tests for 'atanh'
2020-06-11 15:13:19 +02:00
orbitcowboy
0fe0e56986
std.cfg: Added tests for 'acosh'
2020-06-11 15:07:35 +02:00
Daniel Marjamäki
3f1f62e078
Fixed #9746 (SymbolDatabase: Wrong valueType for return)
2020-06-10 21:13:53 +02:00
orbitcowboy
4880f30dc3
std.cfg: Added tests for 'aligned_alloc'
2020-06-10 19:33:22 +02:00
Daniel Marjamäki
d31d778bf4
Fixed #9533 (Syntax Error: AST broken, 'for' doesn't have two operands incrementing pointer in initializer)
2020-06-09 20:57:00 +02:00
Paul Fultz II
0c659a1499
Fix incorrect logic for condition ( #2675 )
2020-06-09 08:16:53 +02:00
Daniel Marjamäki
6d796b434e
Fixed #9731 (ValueFlow: does not handle many assignments well)
2020-06-08 21:17:12 +02:00
Simon Martin
1705d096f7
Simplify empty anonymous namespaces. ( #2673 )
2020-06-07 13:49:04 +02:00
Ken-Patrick Lehrmann
a45c7752a5
9185: Don't syntax error on nested lambdas ( #2672 )
2020-06-07 08:58:12 +02:00
Paul Fultz II
86ed860d26
Fix issue 9548: False negative: Mismatching iterators when inserting into a vector ( #2595 )
2020-06-06 17:54:56 +02:00
Ken-Patrick Lehrmann
99ff04f617
9757: skip template parameters when computing scope ( #2670 )
...
The template parameter is confusing simplifyUsing: it does not compute
properly the scope, and we end up replace "type" in "to_string" with
"void", then later "void" is removed and we have an internal error.
2020-06-06 17:51:15 +02:00
Daniel Marjamäki
44ff22f879
Fixed #9276 (FP literalWithCharPtrCompare)
2020-06-06 17:47:30 +02:00
Daniel Marjamäki
120c572252
Fixed #9750 (Chained stream operation gives uninitvar error)
2020-06-06 15:24:01 +02:00
Ken-Patrick Lehrmann
8c2c81dbcd
Fix some false positive in loop forward analysis ( #2669 )
...
* Fix some false positive in loop forward analysis
In cases like:
```
bool b();
void f()
{
int val[50];
int i, sum=0;
for (i = 1; b() && i < 50; i++)
sum += val[i];
for (; i < 50; i++)
sum -= val[i];
}
```
The forward analysis assumed the second loop was entered, and we ended
up with false positive in it:
`Array 'val[50]' accessed at index 50, which is out of bounds`
* Fix style
2020-06-05 18:06:03 +02:00
Paul Fultz II
3109d16b42
Fix issue 9742: FP iterators3 for address of reference to vector in struct ( #2668 )
2020-06-01 08:53:08 +02:00
Paul Fultz II
eb4754b7d9
Fix issue 9587: False positive: parameter can be declared with const ( #2667 )
2020-05-31 10:10:10 +02:00
Sebastian
5cbed0464c
opencv2.cfg: Add types, macros, functions and memory (de)allocation ( #2620 )
...
* opencv2.cfg: Add types, macros, functions and memory (de)allocation
* cfg/cppcheck-cfg.rng: Allow alloc/realloc functions in classes
2020-05-30 17:41:44 +02:00
Paul Fultz II
eed2e829a7
Revert "Cleanup: Removed Tokenizer::simplifyTokenList2. As a side-effect, rules for "simple" token list are now executed on normal token list." ( #2666 )
...
This reverts commit 187cde183d
.
2020-05-30 11:23:22 +02:00
PKEuS
187cde183d
Cleanup: Removed Tokenizer::simplifyTokenList2. As a side-effect, rules for "simple" token list are now executed on normal token list.
2020-05-29 21:21:07 +02:00
PKEuS
bf69541369
Visual Studio: Use new files precompiled.h with several common includes for core and testrunner.
...
- CLI+Core: Reduces build time by 55% from 3:53 to 1:47
- Testrunner: Reduces build time by 27% from 1:40 to 1:13
2020-05-29 12:16:04 +02:00
Daniel Marjamäki
67115491ea
Fixed #9739 (Tokenizer: simplifyTypedef: wrong simplification in using)
2020-05-29 11:16:49 +02:00
Daniel Marjamäki
7ff692341e
Fixed #9730 (Regression: TEXT macro not handled in windows code)
2020-05-28 22:03:16 +02:00
miltolstoy
79c3af56e4
fix 9296: false negative uninit variable ( #2663 )
2020-05-28 21:28:18 +02:00
Daniel Marjamäki
d64631219b
Fixed #9741 (Wrong value for sizeof)
2020-05-28 21:24:48 +02:00
Paul Fultz II
c9798590ba
Fix issue 9701: False positive. 3rd expression in for uses comma operator. ( #2664 )
2020-05-28 07:41:47 +02:00
Daniel Marjamäki
f482eb49cd
ExprEngine; Fixed bug. Constraint expressions must be boolean
2020-05-27 19:37:07 +02:00
Oliver Stöneberg
3a90341961
some CMake cleanups and additions ( #2639 )
2020-05-27 05:15:46 +02:00
Oliver Stöneberg
4f68d85633
optimized non-matchcompiled Token::simpleMatch() a bit ( #2640 )
2020-05-26 20:13:56 +02:00
Daniel Marjamäki
9edca82138
Fix testrunner
2020-05-25 16:02:34 +02:00
Daniel Marjamäki
f7f26ffe90
Tokenizer: Better handling of c alternative tokens in const method
2020-05-25 15:07:23 +02:00
Paul Fultz II
bbe6157e16
Fix issue 9712: False positive: Returning pointer to local variable when return line implicitly cast to return type ( #2662 )
2020-05-23 23:12:00 +02:00
Ken-Patrick Lehrmann
084529575f
Skip ast validation inside template ( #2661 )
2020-05-23 21:11:08 +02:00
Daniel Marjamäki
5a4b309e6f
Bug hunting: Add 'buffer overflow' check. Detect CVE-2019-19334
2020-05-23 17:50:24 +02:00
Oliver Stöneberg
c1f762b861
disabled some Visual Studio warnings ( #2635 )
2020-05-23 17:42:56 +02:00
orbitcowboy
5142c9e9ed
wxwidgets.cfg: Fixed containerOutOfBounds-false negatives for wxArrayInt and wxArrayString. These containers have std::vector like implementation
2020-05-23 09:24:01 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy ( #2633 )
2020-05-23 07:16:49 +02:00
Paul Fultz II
0832830a95
Fix issue 9721: ValueFlow: Comparison is always false, but ValueFlow says it is always true ( #2658 )
2020-05-23 07:15:13 +02:00
Paul Fultz II
4270819728
Fix issue 9713: FP invalidContainerLoop when modifying container and immediately exiting the loop ( #2659 )
2020-05-23 07:14:45 +02:00
Paul Fultz II
6162ebd608
Fix issue 9714: FP invalidContainer related to auto and std::string::insert ( #2660 )
2020-05-23 07:13:55 +02:00
Paul Fultz II
526abd4b52
Fix issue 9738: ValueFlow: handle std::tie better ( #2657 )
2020-05-22 22:57:20 +02:00
Daniel Marjamäki
c86cfdaa50
Fixed #9736 (False positive: knownArgument in assert calls)
2020-05-22 11:49:28 +02:00
Daniel Marjamäki
43b58dbc9e
Fixed #9729 (AST: lambda with noexcept)
2020-05-22 11:29:10 +02:00
Daniel Marjamäki
ac1ceb85b6
AST: improved AST when expression starts with %char% or %str%
2020-05-22 09:35:55 +02:00
Daniel Marjamäki
81d8686f99
Changed TODO_ASSERT_EQUALS, we have a false negative
2020-05-21 09:12:19 +02:00
Paul Fultz II
8301fa8244
Fix issue 8144: valueFlowBeforeCondition: struct ( #2645 )
2020-05-21 08:47:48 +02:00
orbitcowboy
9861a5291e
Formatted the code, there are no functional changes [ci skip]
2020-05-20 23:45:00 +02:00
miltolstoy
a9d8b3495d
feat: add modulo of one check ( #9528 ) ( #2650 )
2020-05-20 23:01:32 +02:00
PKEuS
fb1afe2345
Fixed test suite: Do no longer apply simplifyTokenList2 to token lists, except for those tests that test those simplifications, because checks are no longer run on that simplified token list
...
Changed failing unit test to TODO tests, as they indicate patterns we do no longer understand properly.
2020-05-20 18:54:16 +02:00
Daniel Marjamäki
f5f7cb7ff7
test: Removed AstStyle::Verbose
2020-05-19 18:27:44 +02:00
shaneasd
44a3501f1b
cleanup after #9700 ( #2648 )
2020-05-19 18:15:05 +02:00
Daniel Marjamäki
32e569704b
executeCommand in CppCheckExecutor or QCheckThread
2020-05-19 16:04:40 +02:00
PKEuS
f6788c0472
Fixed Token::isKeyword: Actually set this flag to a reasonable value in all code paths
2020-05-19 13:47:25 +02:00
PKEuS
c9d8f607df
Optimization: Reduced peak memory usage (30% in my test case) by immediately deleting simplecpp::TokenList while creating the cppcheck TokenList.
2020-05-19 12:08:17 +02:00
PKEuS
4948f85460
Visual Studio: Updated solution
...
- Enable several compiler warnings again
- Let __cplusplus have a reasonable value
2020-05-19 08:35:13 +02:00
PKEuS
d6390dbd14
Optimization: Improved performance of simplifyTypedef for code with lots of typedefs
...
20% performance gain when checking ExtremeTuxRacer sourcecode (with glext.h available)
2020-05-19 08:35:13 +02:00
PKEuS
793ed68029
Refactorization: Moved code from header to source
...
- from utils.h to new utils.cpp
- from token.h to token.cpp
- from valueflow.h to valueflow.cpp
- from errorlogger.h to errorlogger.cpp
2020-05-19 08:35:12 +02:00
Daniel Marjamäki
330e634937
Revert "TestTrac: Add separate file for black box / integration tests in testrunner"
...
This reverts commit e895fa4c3f
.
2020-05-19 07:53:54 +02:00
Daniel Marjamäki
e895fa4c3f
TestTrac: Add separate file for black box / integration tests in testrunner
2020-05-18 20:22:00 +02:00
shaneasd
7bfd686f04
Fix #9700 duplicateBranch false positive from missing scope operator :: in ast ( #2646 )
2020-05-18 19:31:13 +02:00
Daniel Marjamäki
9eda399323
Less strict unknownMacro
2020-05-17 19:12:16 +02:00
Daniel Marjamäki
871cf379d5
ExprData: Better handling of ternary operator
2020-05-15 21:34:52 +02:00
Daniel Marjamäki
76f4fae806
Bug hunting; Started to activate some itc tests for uninitialized variables
2020-05-15 20:58:33 +02:00
Paul Fultz II
d123279fc1
Fix issue 9709: ValueFlow: variable value is not known ( #2643 )
2020-05-14 14:10:32 +02:00
Daniel Marjamäki
4afaff059b
Fix replacement in TestExprEngine
2020-05-13 09:56:21 +02:00
Daniel Marjamäki
0c97625aa0
github actions: Fix TestExprEngine
2020-05-13 09:50:25 +02:00
Daniel Marjamäki
046f8eb6c6
ExprEngine: improved handling when lhs/rhs for && has unknown value
2020-05-10 22:50:23 +02:00
Daniel Marjamäki
08ddd84780
Update copyright year
2020-05-10 11:16:32 +02:00
Daniel Marjamäki
3e0218299b
Revert "Update copyright year"
...
This reverts commit 6eec6c4bd5
.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki
6eec6c4bd5
Update copyright year
2020-05-10 11:11:34 +02:00
Daniel Marjamäki
02d88cb191
Travis: Run TestExprEngine tests
2020-05-08 12:21:22 +02:00
Daniel Marjamäki
4779cb124e
Fixed #9649 (False positive: uninitialized struct member)
2020-05-07 22:27:18 +02:00
Daniel Marjamäki
c04a73f6d8
Travis: Improve bug hunting testing
2020-05-07 18:55:22 +02:00
Daniel Marjamäki
c0be64d694
bug hunting test: adjust itc test script for older python 3.x that does not allow format strings
2020-05-06 11:55:22 +02:00
Daniel Marjamäki
06cb0e99d1
Tokenizer: Fix syntax error when operator* is called
2020-05-04 21:33:30 +02:00
Daniel Marjamäki
901eb15c93
Add bug hunting test case for CVE-2018-20845
2020-05-03 18:46:59 +02:00
Daniel Marjamäki
168f8b08bc
Add bug hunting test case for CVE-2019-13454
2020-05-03 18:33:54 +02:00
Daniel Marjamäki
453a73e740
Add bug hunting test case for CVE-2019-1010315
2020-05-03 18:18:50 +02:00
Daniel Marjamäki
388122b64b
Added bug hunting test case for CVE-2019-14981
2020-05-03 18:07:04 +02:00
Daniel Marjamäki
0f6d8546cd
Add bug hunting test case for CVE-2019-15939
2020-05-03 10:35:38 +02:00
Daniel Marjamäki
40dba74ac8
Add bug hunting test case for CVE-2019-16168
2020-05-03 08:49:24 +02:00
Daniel Marjamäki
4c63940902
Add bug hunting test case for CVE-2019-7156
2020-05-02 22:22:31 +02:00
Daniel Marjamäki
b204be474a
Refactoring bug hunting test cases for CVE issues. Leave source code unmodified.
2020-05-02 21:57:36 +02:00
Daniel Marjamäki
e75c7fa26f
Add bug hunting test case for CVE-2019-10018
2020-05-02 19:56:42 +02:00
Daniel Marjamäki
0fcc0c3f6e
Add bug hunting test case for CVE-2019-10019
2020-05-02 19:51:59 +02:00
Daniel Marjamäki
73c7d8b89d
Add bug hunting test case for CVE-2019-10020
2020-05-02 19:34:33 +02:00
Daniel Marjamäki
22ae962dd1
Added bug hunting test case for CVE-2019-10021
2020-05-02 19:29:56 +02:00
Daniel Marjamäki
09a9556a79
Added bug hunting test case for CVE-2019-10023
2020-05-02 19:25:39 +02:00
Daniel Marjamäki
9587f22834
Add bug hunting test case for CVE-2019-19888
2020-05-02 19:16:26 +02:00
Daniel Marjamäki
eadd5fb97a
Add bug hunting test for CVE-2019-10024
2020-05-02 17:09:43 +02:00
Daniel Marjamäki
5eeeba97eb
SymbolDatabase: Better handling of function pointer function argument
2020-05-02 17:04:54 +02:00
Daniel Marjamäki
90108002e5
Add bug hunting test case for CVE-2019-10025
2020-05-02 11:48:15 +02:00
Daniel Marjamäki
b62214a8fd
Added bug hunting test case for CVE-2019-10026
2020-05-02 11:16:05 +02:00
Daniel Marjamäki
4a96799446
Bug hunting: in cve tests use proper compiler define
2020-05-01 20:29:27 +02:00
orbitcowboy
184977730c
wxwidgets.cfg: Fixed false positive because Cppcheck cfg is not able to handle overloaded functions
2020-05-01 20:12:42 +02:00
Daniel Marjamäki
e52eb087a3
Add bug hunting test CVE-2019-19872
2020-05-01 17:20:13 +02:00
Daniel Marjamäki
5084c253b3
Add bug hunting test CVE-2019-14494
2020-05-01 16:33:14 +02:00
Daniel Marjamäki
34572a40ab
Bug hunting: Fixed handling of switch 'case %char%'
2020-05-01 15:15:24 +02:00
Daniel Marjamäki
2011a4dcbf
Bug hunting: Add CVE test case
2020-05-01 14:27:18 +02:00
Daniel Marjamäki
1683bd38d1
Bug hunting: Added CVE test case
2020-05-01 13:59:17 +02:00
Daniel Marjamäki
daae26c474
Bug hunting: Add CVE test suite
2020-05-01 12:21:08 +02:00
Daniel Marjamäki
ef2e272f20
Fixed test/bug-hunting/itc.py
2020-05-01 10:22:05 +02:00
Daniel Marjamäki
b97250e0fa
ExprEngine; Try to handle assignments better
2020-04-30 21:05:34 +02:00
Daniel Marjamäki
dab8b9fd31
ExprEngine: Improved checking of contracts in function calls
2020-04-28 17:16:13 +02:00
Daniel Marjamäki
2e369cc842
astyle formatting
...
[ci skip]
2020-04-27 17:35:52 +02:00
Lionel Gimbert
ad6be7b122
Enforcing CppCoreGuideline C.35 on virtual class destructor ( #2572 )
...
* Enforcing CppCoreGuideline C.35
A base class destructor should be either public and virtual, or protected and non-virtual
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rc-dtor-virtual
* Protected destructor of ciurtual class can be virtual
2020-04-27 09:22:42 +02:00
Daniel Marjamäki
47c998e52d
Fixed #9689 (setVarId: wrong varid when 'not' is used)
2020-04-25 14:42:45 +02:00
Paul Fultz II
2a09465a07
Fix issue 9686: Regression: ValueFlow should handle try/catch better ( #2618 )
2020-04-22 19:20:03 +02:00
Oliver Stöneberg
1af959af2c
fixed -Wextra-semi-stmt Clang warnings ( #2553 )
...
* fixed -Wextra-semi-stmt Clang warnings
* adjusted REDIRECT macro to require a semicolon
* testmathlib.cpp: rolled back accidental change
2020-04-21 17:27:51 +02:00
Daniel Marjamäki
bda73600e0
Tokenizer: Improved removal of unused template ( #9588 )
2020-04-20 20:48:22 +02:00
Daniel Marjamäki
da6e0308c5
Fixed #9195 (False positive: shadowFunction when constructor is shadowed)
2020-04-20 18:02:10 +02:00
Zorgovskiy
08fc956990
Fixes issue #9664 ( #2614 )
2020-04-20 08:59:35 +02:00
Daniel Marjamäki
219180b00a
Fixed #9038 (Auto type with explicit pointer symbol detected as integer)
2020-04-19 20:08:47 +02:00
Daniel Marjamäki
e8bbfdbfee
Fixed #9559 (Multiple checks to std::atomic are not redundant)
2020-04-19 17:29:40 +02:00
Daniel Marjamäki
3c56ccc33f
Fixed #9531 (Syntax Error: AST broken, 'for' doesn't have two operands.)
2020-04-19 17:00:22 +02:00
Paul Fultz II
e2efb338b6
Fix issue 9678: False positive: generic valueflow forward analysis ( #2611 )
2020-04-19 08:28:07 +02:00
Daniel Marjamäki
54978847c5
Fixed #8916 (FP: followVar does not seem to handle non-const method call properly)
2020-04-18 19:54:55 +02:00
Daniel Marjamäki
de53f63f76
Fixed #9665 (Tokenizer::setVarId: for loop variables)
2020-04-18 12:08:53 +02:00
Daniel Marjamäki
4ba2aa82bb
astyle formatting
...
[ci skip]
2020-04-18 09:38:23 +02:00
Carl Michael Grüner Monzón
7c93f51885
Consider pre{inc,dec}rements on assert checks ( #2605 )
...
* Consider pre{inc,dec}rements on assert checks
* Simplify code by using new AST APIs
* Fix assert test with invalid syntax
2020-04-18 09:26:24 +02:00
Paul Fultz II
453a69dd8c
Fix issue 9677: False positive: returning pointer to oject that will not be invalid ( #2607 )
...
* Fix issue 9677: False positive: returning pointer to oject that will not be invalid
* Formatting
2020-04-18 09:23:10 +02:00
Daniel Marjamäki
aa1bbf2e62
Fixed #9679 (False positive: use this after free (lambda not executed directly))
2020-04-17 20:20:45 +02:00
Daniel Marjamäki
e4bea02cad
Fixed #7578 (varid not set for 'pointer to array' member variable in method)
2020-04-15 20:56:21 +02:00
Paul Fultz II
985c82730e
Add regression test for 9573: ValueFlow: Wrong tracking of value in function call ( #2603 )
2020-04-15 08:09:36 +02:00
Daniel Marjamäki
98be091d80
Fixed typedef simplification for array of function pointers
2020-04-13 16:28:01 +02:00
Oliver Stöneberg
2c1e36e63e
cleaned up includes based on include-what-you-use ( #2600 )
...
* cleaned up includes based on include-what-you-use
* check.h: trying to work around Visual Studio 2012 bug
* fixed Visual Studio compilation
2020-04-13 13:44:48 +02:00
shaneasd
82c09f243b
Maybeunusedsupport ( #2570 )
...
* Add rudimentary support for [[maybe_unused]]
* Add more test cases. use the symboldatabase rather than reparsing. Fix travis error.
* test review actions
* change var to usage._var
2020-04-12 20:35:54 +02:00
Daniel Marjamäki
6b579293b6
Clang import; Destructor
2020-04-12 17:27:49 +02:00
Daniel Marjamäki
97b04ba9a7
Syntax check: Using keyword in global scope
2020-04-11 17:36:22 +02:00
Paul Fultz II
8b27f1c216
Fix issue 9667: crash: crash in valueflow for weird code where label address is returned ( #2602 )
2020-04-11 13:56:53 +02:00
Daniel Marjamäki
e8e3c2660d
Detect syntax error 'x ==> y'
2020-04-11 11:05:27 +02:00
Daniel Marjamäki
c029d5150c
Fixed #9123 (False positive: uninitialized variable)
2020-04-10 12:33:15 +02:00
Daniel Marjamäki
0725c2290c
Tokenizer: Do not simplify function pointers to normal pointers as we loose important information
2020-04-10 11:53:32 +02:00
Daniel Marjamäki
e0c8118c02
Fixed crash in AST
2020-04-09 17:42:51 +02:00
Daniel Marjamäki
8e9d7290b2
Tokenizer::simplifyTypedef: Better handling of r-value references
2020-04-08 22:40:45 +02:00
Daniel Marjamäki
37a4e375ba
astyle formatting
...
[ci skip]
2020-04-08 22:39:17 +02:00
Achouv
7719e4309d
avoid false positive unused static const struct member ( #2598 )
2020-04-08 18:09:20 +02:00
Paul Fultz II
3773d0e875
Find more redundant conditions ( #2597 )
2020-04-07 07:15:15 +02:00
Daniel Marjamäki
66ee3a0afc
Clang import: Better handling of methods that are defined after declaration
2020-04-06 17:18:52 +02:00
Paul Fultz II
8fd0839fea
Add regression test for 9534: False positive: Returning pointer to local variable 'x' that will be invalid when returning. ( #2596 )
2020-04-06 16:02:10 +02:00
Daniel Marjamäki
8dd0a9241c
TemplateSimplifier: Simplification of const types
2020-04-05 13:51:58 +02:00
Daniel Marjamäki
f01783238e
Fixed #9596 (False positive: Returning an integer in a function with a pointer return type auto handling)
2020-04-04 20:03:48 +02:00
Paul Fultz II
efdc5f5c4e
Fix issue 9435: False negative: invalidContainer when using range for loop ( #2587 )
...
* Fix issue 9435: False negative: invalidContainer when using range for loop
* Use ast
* Make string const
2020-04-04 11:47:02 +02:00
Oliver Stöneberg
1dd8d4afaf
fixes for Clang and clang-tidy 10 ( #2588 )
...
* clang_tidy.cmake: added clang-tidy-10 to program list
* fixed -Wrange-loop-construct Clang warnings
* fixed readability-qualified-auto clang-tidy warnings
* .clang-tidy: actually disable clang-analyzer-* warnings
* .clang-tidy: disabled some new warnings introduced with clang-tidy-10
2020-04-04 11:44:59 +02:00
Paul Fultz II
40e1e82a65
Fix issue 9644: Token::astOperand1() cyclic dependency on valid C++ code ( #2590 )
...
* Remove check for lambda
* Add test case
2020-04-04 10:55:31 +02:00
Daniel Marjamäki
e0acd1abf8
Tokenizer: Report unknown macro that contains '.x=..' argument
2020-04-04 10:32:56 +02:00
Paul Fultz II
58e3f19ed8
Fix issue 9662: AST broken, ternary operator missing operand(s) on valid C++ code ( #2589 )
...
* Fix issue 9662: AST broken, ternary operator missing operand(s) on valid C++ code
* Add test for issue 9537
2020-04-03 10:04:10 +02:00
Paul Fultz II
71deaaeb18
Fix issue 9608: False Positive: returnDanglingLifetime with braced-init-list ( #2583 )
2020-04-02 10:17:58 +02:00
Paul Fultz II
02ae71917a
Fix issue 9536: False positive: Reference to temporary returned when using operator() ( #2582 )
...
* Fix issue 9536: False positive: Reference to temporary returned when using operator()
* Add more test cases
2020-04-01 22:35:41 +02:00
Paul Fultz II
6cc58e1086
Set a max for the combination of arguments that can be passsed through valueFlowSubFunction ( #2579 )
...
* Set a max for the combination of arguments that can be passsed
* Skip mismatch path ids when computing the cross product
2020-04-01 22:33:09 +02:00
Dmitry-Me
b51e4dfeea
Improved test to have all lines reached
2020-03-27 19:11:38 +03:00
Dmitry-Me
e1d38a854b
Improved test to have all lines reached
2020-03-25 18:11:05 +03:00
Paul Fultz II
5462e43161
Fix issue 9639: False positive: Returning object that points to local variable that will be invalid when returning ( #2576 )
...
* Follow reference when tracking local variables
* Fix issue 9639: False positive: Returning object that points to local variable that will be invalid when returning
2020-03-23 22:54:53 +01:00
Paul Fultz II
b68d6f9471
Fix crash in valueflow when using local classes ( #2575 )
2020-03-22 10:12:53 +01:00
Paul Fultz II
7fd3580f21
Dont traverse conditions multiple times ( #2574 )
2020-03-20 10:37:16 +01:00
Paul Fultz II
f2527f5340
Fix crash in valueFlowForLoopSimplifyAfter ( #2573 )
2020-03-20 07:16:05 +01:00
Daniel Marjamäki
1173186876
Fixed daca@home crash by stopping for unknown macro 'MACRO(a();b();)'
2020-03-12 13:28:09 +01:00
Daniel Marjamäki
900b99fbd8
Tokenizer; Report unknown macro used in function declaration
2020-03-10 20:22:46 +01:00
Sebastian
b8432b7e23
testsymboldatabase.cpp: Fix AppVeyor build error ( #2568 )
2020-03-10 12:26:00 +01:00
Daniel Marjamäki
f093d23a36
SymbolDatabase: Fixed addArguments
2020-03-09 15:13:50 +01:00
Daniel Marjamäki
1008868506
AST: Better handling of '(type){..}'
2020-03-08 16:46:06 +01:00
Daniel Marjamäki
cdee62c032
AST: Fixed AST for struct cast '(struct T){...}'
2020-03-08 16:21:22 +01:00
Daniel Marjamäki
5ea01c5d60
Fix Cppcheck warning
2020-03-08 10:02:46 +01:00
Daniel Marjamäki
5376ba1701
AST: Throw validation exception if ternary operator is missing operands
2020-03-07 21:46:38 +01:00
amai2012
b795d30db6
Enable another zeroDivCond test which got fixed recently
2020-03-06 17:15:54 +01:00
orbitcowboy
f05c504440
Running astyle [ci skip]
2020-03-03 20:38:30 +01:00
Dmitry-Me
b61feff125
Improve test coverage for detecting invalid pointers
2020-03-02 19:01:27 +03:00
Paul Fultz II
6ea4f60600
Enable valueFlowSubfunction for multiple parameters ( #2550 )
2020-03-01 16:46:20 +01:00
Daniel Marjamäki
5df6d5bc7c
Tokenizer; Warn about unknown macro used in string concatenation
2020-02-28 21:52:01 +01:00
Sebastian
f0e3f9e79a
gtk.cfg: Fix/enhance Gtk library configuration (g_abort and others) ( #2558 )
...
test/CMakeLists.txt: Fix missing INCONCLUSIVE for Gtk configuration test
2020-02-27 13:16:43 +01:00
Daniel Marjamäki
38b570138f
AST: Try to handle c++17 for properly 'for (auto [a,b]:c)'
2020-02-27 09:58:53 +01:00
Daniel Marjamäki
84995485ea
VarId: fixed varids for 'for (auto [x,y]: xy)'
2020-02-27 07:18:07 +01:00
orbitcowboy
a5ca3cb1f0
wxwidgets.cfg: Fixed FP for wxSizer::Add()
2020-02-26 16:10:10 +01:00
Sebastian
8fd17546ad
qt.cfg: #9650 : Fix missing configuration for QString.chop() ( #2556 )
...
chop() and also remove() change the size of a QString, so they have to
be added in the container configuration accordingly to avoid false
positives.
2020-02-26 10:53:03 +01:00
Sebastian
fb36889d29
gtk.cfg: Fix syntax errors and false positives ( #2552 )
...
A missing definition for g_assert_cmp*() causes syntax errors if code
like g_assert_cmpint(a, ==, b); is encountered.
The function g_hash_table_iter_replace() does not have to be marked
with leak-ignore since the memory could be freed later if corresponding
functions are present in the GHashTable. Since we can not know if this
is the case we have to assume that the memory is freed to avoid false
positives. The same is true for g_hash_table_insert() and
g_hash_table_replace().
2020-02-26 10:33:23 +01:00
orbitcowboy
b32a89924c
wxwidgets.cfg: Added <not-bool/>-flag at more function args.
2020-02-25 21:48:15 +01:00
Daniel Marjamäki
e4937ed621
AST: Fixed wrong AST for cast '(std::vector<int>&&)s->second'
2020-02-25 21:05:49 +01:00
orbitcowboy
e9937e3acb
wxwidgets.cfg: Fixed recently introduced FP.
2020-02-25 20:23:20 +01:00
Rikard Falkeborn
9896dce7f2
checkuninitvar: Fix FN with c++ casts ( #2549 )
2020-02-23 19:53:17 +01:00
Daniel Marjamäki
4f9a0b8420
Refactoring suppressions
2020-02-23 19:49:53 +01:00
ghking
5479c7340b
a new method to declare inline suppress which is more readable and more convenient. ( #2533 )
2020-02-23 18:04:24 +01:00
Daniel Marjamäki
ef26b55737
AST: Fix wrong handling for '{scope} (expr)'
2020-02-23 15:01:06 +01:00
Rikard Falkeborn
1f668c8dc4
Add regression test for #9187 ( #2548 )
...
This was fixed in ae0a73a53
.
2020-02-22 21:26:26 +01:00
orbitcowboy
84d2c86d74
posix.cfg: Added more <not-bool/>-flags.
2020-02-22 14:49:36 +01:00
orbitcowboy
e1eb7e04b5
std.cfg: Added <not-bool/>-flags for some functions from <cwctype>
2020-02-22 14:24:14 +01:00
Daniel Marjamäki
f07a71e3e1
Report unknown macros for pattern '%name% %num%'
2020-02-22 11:57:36 +01:00
orbitcowboy
a62ddc6edd
std.cfg: Added <not-bool/>-tag to isblank() function arg.
2020-02-22 09:43:15 +01:00
orbitcowboy
be96abc21a
std.cfg: Added <not-bool/>-tags to <cctype> function args.
2020-02-22 09:39:21 +01:00
Daniel Marjamäki
cf10b1a220
fix ast for expression that starts with number
2020-02-21 21:11:32 +01:00
Daniel Marjamäki
ec8c733afb
Improved Qt simplification
2020-02-21 19:04:21 +01:00
Daniel Marjamäki
388b5118df
Fixed bad ast (wrong result from iscast())
2020-02-21 17:15:33 +01:00
Daniel Marjamäki
26a11e20d0
Revert "Fix crash with garbage code ( #2547 )"
...
This reverts commit b25709a492
.
The real problem was wrong AST for valid code, I want to fix that instead.
2020-02-21 09:35:01 +01:00
Paul Fultz II
b25709a492
Fix crash with garbage code ( #2547 )
2020-02-21 06:53:28 +01:00
Daniel Marjamäki
6f6f9dd5bc
Tokenizer: Throw unknownMacro in non-executable scope
2020-02-19 21:12:58 +01:00
Paul Fultz II
392060aefe
Fix issue 7804: ValueFlow: possible value in second if body ( #2543 )
2020-02-19 07:55:04 +01:00
Rikard Falkeborn
f6e7fb4bd9
Bugfix valuetype for some integer constants ( #2545 )
2020-02-19 07:51:39 +01:00
Daniel Marjamäki
95ac456e13
Fixed #9582 (false positive "error: Out of bounds access" with std::array and constant)
2020-02-19 07:36:02 +01:00
Daniel Marjamäki
1fd85c0ae8
Fixed #9630 (False positive: in stlIfFind checking, if with initializer is not handled properly)
2020-02-18 19:02:54 +01:00
Daniel Marjamäki
afb5590741
New check: delete 'self pointer' that might be used as 'this' and then use some member/method
2020-02-18 18:24:18 +01:00
Daniel Marjamäki
244e291605
Fixed #9640 (clang import: reference parameter)
2020-02-17 18:56:25 +01:00
Paul Fultz II
3b20684aca
Fix issue 9360: False positive: arrayIndexOutOfBounds when function is called with different array sizes ( #2541 )
2020-02-17 10:31:08 +01:00
Ken-Patrick Lehrmann
7044c17599
9575: false positive in fclose ( #2540 )
...
Fix false positive introduced by
0b7649ca9b
Only return the function token from checkTokenInsideExpression when it
might be one the argument (hence keeping a pointer to one of them).
Otherwise, we can directly skip to the token after the function call.
2020-02-17 10:25:30 +01:00
Daniel Marjamäki
ae0a73a538
Fixed #9618 (isCast flag not set for c++ casts)
2020-02-16 16:46:40 +01:00
Paul Fultz II
921887a281
Use valueFlowGeneric for valueFlowForwardExpression ( #2537 )
2020-02-16 16:02:22 +01:00
Paul Fultz II
95a48eac67
Fix issue 9598: False positive: Using iterator to local container that may be invalid for loop handling ( #2539 )
2020-02-16 15:56:52 +01:00
Daniel Marjamäki
a350ed9bc2
Fixed #9023 (AST: wrong lhs for a = b + foo(A::Hash{}("")))
2020-02-16 13:58:43 +01:00
Daniel Marjamäki
320cb9008f
minor tweaks of knownConditionTrueFalse
2020-02-15 20:21:13 +01:00
Daniel Marjamäki
67b495fc50
Fixed #9280 (False positive: unreadVariable on assignment to fixed address volatile struct member)
2020-02-15 17:31:47 +01:00
Daniel Marjamäki
8c0ad6a1b9
Fixed #9555 (False positive (unreadVariable): struct is assigned a value that is never used)
2020-02-15 16:43:06 +01:00
Daniel Marjamäki
569b2a4171
Fixed #9600 (false positive: compareBoolExpressionWithInt with --clang)
2020-02-15 14:45:12 +01:00
Paul Fultz II
61d847cac2
Fix issue 9637: false positive: Condition 'i<2U' is always true ( #2536 )
2020-02-15 07:57:43 +01:00
Daniel Marjamäki
332279326f
checkVirtualFunctionCallInConstructor; Check should be 'style' since there is no UB. Disabled the check temporarily, it should use CTU to determine if the class is a base class
2020-02-14 17:10:12 +01:00
Daniel Marjamäki
e31b2f8b73
SymbolDatabase; Set smart pointer type in Variable valueType
2020-02-14 09:40:27 +01:00
Paul Fultz II
7368a54629
Add generic valueflow forward analysis ( #2511 )
2020-02-13 16:27:06 +01:00
Daniel Marjamäki
3ec03b8915
Fixed #9571 (False positive: containerSize)
2020-02-12 18:53:36 +01:00
Dmitry-Me
25deb996e9
Improve test coverage for matching paths
2020-02-11 18:19:39 +03:00
Paul Fultz II
d858bfc338
Fix issue 9599: False positive: Using object that points to local variable that may be invalid ( #2530 )
...
* Fix issue 9599: False positive: Using object that points to local variable that may be invalid
* Improve tests
* Skip else
2020-02-11 11:45:10 +01:00
Paul Fultz II
e55ddacd18
Fix issue 9597: False positive: Reference to temporary returned if explicitly casted to base class ( #2531 )
2020-02-11 11:41:41 +01:00
Paul Fultz II
8fa7dd0fe0
Fix issue 9595: False positive: Using pointer to temporary doesn't account for const ref extended temporary lifetimes ( #2525 )
2020-02-10 18:01:11 +01:00
IOBYTE
4d58d9fc87
fix daca chromium crash ( #2527 )
2020-02-09 11:19:36 +01:00
Rikard Falkeborn
b1c6f2946a
Fix redundant FP assignment with unsigned zero ( #2521 )
...
* Refactor isNullOperand out of FwdAnalysis
* Improve isNullOperand
* Fix redundantAssignment FP with unsigned zero
* isNullValue check number
* Enhance isNullOperand to handle c++ casts
Also handle cast of NULL.
2020-02-09 11:16:08 +01:00
Daniel Marjamäki
ca3095746c
Fixed #9594 (False positive: Using argument that points at uninitialized variable when write only)
2020-02-04 18:56:18 +01:00
Dmitry-Me
84f65c40a7
Improve test coverage for templates with comparison in default value
2020-02-03 18:36:51 +03:00
Rikard Falkeborn
488bc9997c
Improve isSameExpression for same valued literals with followvar ( #2519 )
...
It allows (for example) cppcheck to detect that the lhs and the rhs are
the same in the following example:
double g()
{
double a = 1e1
return a & 10.0;
}
2020-02-03 09:35:24 +01:00
Rikard Falkeborn
bbfd10a69f
Bugfix Mathlib::isNullValue for hexadecimal numbers ( #2517 )
2020-02-02 16:40:36 +01:00
Rikard Falkeborn
ff9c04dc28
Improve isSameExpression for literals ( #2514 )
...
Improve isSameExpression() for literals with same value but different
representation, for example the following different ways of
representing 9 as double: 9.0, 0.9e1 and 0x1.2p3.
With this change, cppcheck can (for example) correctly detect that the
else if statements are always false in the following example:
void f(double x) {
if (x < 9.0) {}
else if (x < 0x1.2p3) {}
else if (x < 0.9e1) {}
}
2020-02-01 07:22:41 +01:00
Dmitry-Me
589b497ead
Improve test coverage for simplification of bitwise operations
2020-01-30 18:21:22 +03:00
Daniel Marjamäki
dcee189146
Tokenizer::setVarId: better handling of decltype()
2020-01-29 17:40:22 +01:00
Daniel Marjamäki
18124fe248
Fixed #9591 (SymbolDatabase: decltype)
2020-01-29 17:29:40 +01:00
Dmitry-Me
ee86aa7b40
Improve test coverage for simplification of arithmetic operations
2020-01-29 18:16:07 +03:00
Daniel Marjamäki
b1abcc06df
Clang import; distinguish static variable
2020-01-27 13:00:52 +01:00
Daniel Marjamäki
830f901206
Fixed #9586 (Valuetype: Wrong type for 'true << 1')
2020-01-27 11:46:59 +01:00
Rikard Falkeborn
8819e19dae
Fix #8489 (Fix FN printf argument with parenthesis) ( #2508 )
2020-01-27 06:55:01 +01:00
Daniel Marjamäki
b6833b525f
Clang import
2020-01-25 17:01:17 +01:00
Daniel Marjamäki
f911495db3
Clang import; Handle clang-9 while loop better
2020-01-25 16:10:13 +01:00
Daniel Marjamäki
0bab9ba6e3
Clang import; Handle clang-9 range for loop
2020-01-25 14:47:51 +01:00
Simon Martin
2840173a72
Ticket #9569 : Do not substitute type aliases within enum definitions. ( #2504 )
2020-01-25 10:18:37 +01:00
Simon Martin
224a41361d
Ticket #9572 : Properly detect designated initializers. ( #2496 )
2020-01-25 10:14:16 +01:00
Daniel Marjamäki
569523bbef
Clang import; Better handling of enums
2020-01-25 09:31:47 +01:00
Daniel Marjamäki
1cabba8755
Clang import; Improved enum handling
2020-01-24 21:34:29 +01:00
Aleksandr Serbin
11993ed999
Ticket 5607: Allow to exclude folders with glob pattern ( #2498 )
2020-01-24 07:06:09 +01:00
Daniel Marjamäki
fc813cef2a
Clang import: IfStmt
2020-01-23 16:18:39 +01:00
Daniel Marjamäki
ce77db2b1b
Clang import; EnumDecl
2020-01-23 16:06:25 +01:00
Daniel Marjamäki
4235a29501
ExprEngine: Handle variable annotations better
2020-01-21 18:55:07 +01:00
Daniel Marjamäki
b6db5116c3
Clang import; CXXStdInitializerListExpr
2020-01-21 18:29:04 +01:00
Daniel Marjamäki
a20b3a9e2e
Clang import; better handling of string literals
2020-01-21 17:47:57 +01:00
Daniel Marjamäki
6386f0e633
Clang import; CXXDeleteExpr
2020-01-21 17:47:57 +01:00
Dmitry-Me
51e775e21e
Improve test coverage for reading numbers represented as strings
2020-01-21 19:29:33 +03:00
Daniel Marjamäki
9f26e8a356
Clang import; CXXNewExpr
2020-01-21 12:16:39 +01:00
Daniel Marjamäki
7fecc17707
Clang import; CXXThrowExpr
2020-01-21 11:16:22 +01:00
Daniel Marjamäki
459e906ae1
Clang import; ConditionalExpr
2020-01-21 07:00:03 +01:00
Daniel Marjamäki
78fcf93342
Clang import; DoStmt
2020-01-20 20:46:33 +01:00
Daniel Marjamäki
cd3ad89777
Clang import; GotoStmt, LabelStmt
2020-01-20 19:07:10 +01:00
Daniel Marjamäki
6722ee9d3f
test/bug-hunting: add --clang option to the juliet testing
2020-01-20 18:53:40 +01:00
Daniel Marjamäki
3ccd369cf5
Clang import; CaseStmt
2020-01-20 17:38:54 +01:00
Daniel Marjamäki
d635ea4b7f
Clang import; SwitchStmt
2020-01-20 14:24:03 +01:00
Daniel Marjamäki
8d6891ac81
bug hunting; modified itc test script so you can pass --clang to it
2020-01-20 10:43:42 +01:00
Daniel Marjamäki
3d1cb87a11
Clang import; range for
2020-01-18 19:23:37 +01:00
Daniel Marjamäki
269d21e972
Clang import; Better array handling in sizeof()
2020-01-18 11:55:50 +01:00
Daniel Marjamäki
b905547c76
Clang import; Better sizeof/type handling
2020-01-18 11:07:36 +01:00
Daniel Marjamäki
f7a30fc99f
Rename Verification => Bughunting
2020-01-18 07:25:57 +01:00
Rikard Falkeborn
0bb98aeef9
Fix 9577 (endless recursion in Valueflow::bifurcate()) ( #2492 )
...
Ensure bifurcate() does not recurse endlessly where a variable is
initialized recursively, or a variable is initialized as x(0) or x{0}
followed by a recursive assignment (for example int x(0); x = x / 1;).
The first case is solved by bailing out if there initialization is done
using x(0) or x{0}, the second by adding a missing depth argument to a
recursive call.
2020-01-17 03:17:26 +01:00
Daniel Marjamäki
bc39cd73f0
Clang import; fix wrong 'sizeof' import
2020-01-17 03:15:08 +01:00
Daniel Marjamäki
fddc301f7b
Rename test cases, 'verification' was renamed to 'bug hunting'
2020-01-15 21:11:04 +01:00
Daniel Marjamäki
76a048a2c1
Bug hunting; 'hide' the uninitialized variables checking, I need to focus on division by zero and clang import
2020-01-15 21:06:00 +01:00
Daniel Marjamäki
c79ec9e956
ExprEngine: sizeof()
2020-01-15 15:24:36 +01:00
Daniel Marjamäki
7820b5dbcc
Rename 'Verification' to 'Bug hunting'
2020-01-14 21:17:07 +01:00
Daniel Marjamäki
434b506e58
testsuites/danmar-verify: fix syntax errors
2020-01-14 10:28:05 +01:00
Daniel Marjamäki
dfbf347912
Clang import; Better type
2020-01-13 17:56:30 +01:00
Daniel Marjamäki
066e43cce3
Clang import; InitListExpr
2020-01-13 12:44:35 +01:00
Daniel Marjamäki
bd41b3d713
Clang import; Fixed function arguments in SymbolDatabase
2020-01-13 05:52:46 +01:00
Daniel Marjamäki
9f3df5d630
Clang import; CompoundAssignOperator
2020-01-12 18:41:46 +01:00
Daniel Marjamäki
f4f4377fbf
Clang import; Constructor arguments, ExprWithCleanups
2020-01-12 16:49:02 +01:00
Daniel Marjamäki
d1f3ecec12
Verification; Tweak itc test script, avoid duplicate linenumbers
2020-01-12 10:53:44 +01:00
Daniel Marjamäki
7704f6578f
Verification; Fix struct member false negative
2020-01-12 10:29:03 +01:00
Steven Hoving
26e403893c
googletest.cfg; add MATCHER ( #2485 )
2020-01-12 08:11:58 +01:00
Rikard Falkeborn
c6e74f4c10
Mathlib: Fix value of suffixed binary integer literal ( #2487 )
2020-01-12 08:11:12 +01:00
Daniel Marjamäki
aa090a8b45
Clang import; addTypeTokens for function return type
2020-01-11 16:40:22 +01:00
Daniel Marjamäki
05a34142aa
Clang import; forward class declaration
2020-01-11 16:02:25 +01:00
Daniel Marjamäki
9c38a659a1
Clang import; Fixed CXXConstructExpr without child
2020-01-11 12:16:48 +01:00
Daniel Marjamäki
30bc67c691
Clang import; CXXNullPtrLiteralExpr
2020-01-10 19:01:33 +01:00
Daniel Marjamäki
7a3bedb583
Clang import; CXXConstructExpr
2020-01-10 18:54:28 +01:00
Daniel Marjamäki
4c778e0999
Clang import; Rename files/namespace
2020-01-10 16:29:06 +01:00
Daniel Marjamäki
8f1a50ffc0
Clang import; CStyleCastExpr
2020-01-10 16:19:01 +01:00
Daniel Marjamäki
e78775fac3
astyle formatting
...
[ci skip]
2020-01-10 11:31:12 +01:00
Daniel Marjamäki
a0a2eae1d2
Clang import; cxxStaticCastExpr2
2020-01-10 11:04:51 +01:00
Rikard Falkeborn
9afeef01c6
Improve duplicateExpressionTernary ( #2484 )
...
Test both the cases where sizeof(int) == sizeof(long) and when they are
different to improve testing.
2020-01-10 10:02:50 +01:00
fuzzelhjb
fcd5cda97f
Check selected files from project ( #2378 )
2020-01-10 08:57:37 +01:00
Daniel Marjamäki
b8aa71bc87
Clang import; CXXStaticCast
2020-01-09 20:53:06 +01:00
Daniel Marjamäki
bf62138237
Verification; Remove VERIFY_UNINIT define, the checking is always compiled from now on
2020-01-09 20:25:52 +01:00
Daniel Marjamäki
ae5dbe0575
Clang import; UnaryOperator
2020-01-09 19:07:14 +01:00
Daniel Marjamäki
2137f1ead9
Clang import; reference before declaration
2020-01-09 18:03:24 +01:00
Daniel Marjamäki
d842f00aef
Clang import; UnaryExprOrTypeTraitExpr
2020-01-09 17:31:46 +01:00
Daniel Marjamäki
7daa1bc11d
Clang import: CharacterLiteral
2020-01-09 16:54:45 +01:00
Daniel Marjamäki
fea981211e
Clang import; CXXBoolLiteralExpr
2020-01-09 16:19:38 +01:00
Dmitry-Me
9d8f67a6ca
Improve test coverage for MathLib::calculate()
2020-01-09 18:18:03 +03:00
Daniel Marjamäki
e6b873b7b9
Clang import; CXXOperatorCallExpr
2020-01-09 15:59:22 +01:00
Daniel Marjamäki
060c695f80
Clang import; CXXConstructorDecl, CXXThisExpr
2020-01-09 13:19:14 +01:00
Daniel Marjamäki
1589ac5352
Clang import; Set links properly
2020-01-09 12:42:29 +01:00
Daniel Marjamäki
0becff9d7f
testsuites/danmar-verify: Add divbyzero tests
2020-01-09 10:48:43 +01:00
Ken-Patrick Lehrmann
0b7649ca9b
Fix 9298 ( #2476 )
...
* Fix 9298
Tell cppcheck that strcpy returns its first argument, and use that
knowledge in checkTokenInsideExpression.
* Add missing unit tests in cmake
2020-01-09 08:47:36 +01:00
Maksim Derbasov
872d531568
Removing check hidingInheritedPublic ( #2482 )
2020-01-09 06:53:08 +01:00
Daniel Marjamäki
4e8a922e18
Clang import; CXXMemberCall
2020-01-08 21:49:23 +01:00
Daniel Marjamäki
3387ee3512
Clang import; ClassTemplateDecl
2020-01-08 21:31:06 +01:00
Daniel Marjamäki
eb3270959e
Clang import; FunctionTemplateDecl
2020-01-08 20:47:52 +01:00
Daniel Marjamäki
64953f36b3
Clang import: CXXRecordDecl, CXXMethodDecl
2020-01-08 19:32:04 +01:00
Daniel Marjamäki
54a9b61329
Clang import; NamespaceDecl, varDecl4, varDecl5
2020-01-08 18:23:40 +01:00
Daniel Marjamäki
b8ae957365
Clang import; fwrite FunctionDecl
2020-01-08 16:42:21 +01:00
Daniel Marjamäki
c4c929a6a7
Clang import: StringLiteral, funcdecl3, determine includes with clang -v
2020-01-08 16:36:51 +01:00
Daniel Marjamäki
f51048e03b
Clang Import; TypedefDecl
2020-01-08 14:25:09 +01:00
Daniel Marjamäki
e6ee29fd11
Clang import; BreakStmt, ContinueStmt
2020-01-08 12:29:54 +01:00
Daniel Marjamäki
ea414e46e1
Clang import; WhileStmt
2020-01-08 12:19:48 +01:00
Daniel Marjamäki
61039023b2
Clang import; ForStmt
2020-01-08 10:35:44 +01:00
Daniel Marjamäki
4b7e6c68b0
Clang import; MemberExpr
2020-01-08 09:51:35 +01:00
Daniel Marjamäki
e5b99d3299
Clang import; Refactoring
2020-01-07 19:47:06 +01:00
Daniel Marjamäki
a3abc75ca1
Clang import; RecordDecl
2020-01-07 18:33:24 +01:00
Daniel Marjamäki
c4131bbc5b
Clang import; else
2020-01-07 12:38:37 +01:00
Daniel Marjamäki
b829c4cebb
Clang import; Arrays
2020-01-07 12:19:06 +01:00
Daniel Marjamäki
6a4a59b783
Clang Import; Added test
2020-01-06 16:45:18 +01:00
amai2012
b621c35539
Astyle formatting [ci skip]
2020-01-05 17:00:34 +01:00
Paul Fultz II
90f82d0374
Fix issue 9541: false negative: knownConditionTrueFalse ( #2473 )
...
* Fix issue 9541: false negative: knownConditionTrueFalse
* Add another test case
* Add another test
* Fix FPs
* Format
* Fix compile error
* Remove double conditions
* Fix compile error
2020-01-05 16:25:33 +01:00
Ken-Patrick Lehrmann
5f73e1cb32
Fix 9546: properly check that the bound is the size ( #2475 )
...
Previously, as the check was done on the token and not on the ast,
`i <= v.size()` and `i <= v.size() - 2` would both raise the same
warning.
This patch fixes this, but this mean the check is only done when the
condition if `i <= v.size()`. Any other (more complex) condition is
ignore, and so we have false negative for instance with
`i <= v.size() + 1`.
2020-01-05 16:24:25 +01:00
Maksim Derbasov
a3ed9116e5
Clarify error msg for hidingInheritedPublic ( #2474 )
2020-01-05 09:32:39 +01:00
Paul Fultz II
e1a97c524d
Fix issue 9554: False positive: The address of local variable 'x' is accessed at non-zero index. ( #2470 )
...
* Fix issue 9554: False positive: The address of local variable 'x' is accessed at non-zero index.
* Format
* Remove unnecesary condition check
2020-01-04 11:39:52 +01:00
Ken-Patrick Lehrmann
a9d423eef2
Fix #8938 : FP identicalInnerCondition ( #2471 )
2020-01-04 11:38:56 +01:00
Ken-Patrick Lehrmann
eca7ee9260
9356: Prevent false positive when passing non-const reference to member constructor ( #2370 )
...
* Add cases for 9356
* 9356: Prevent false positive when passing non-const reference to member constructor
This workarounds false positives 'Parameter can be declared with const [constParameter]'
when said parameter is used in constructor call. It assume the
constructor call might change the parameter (without any checks.
The drawback is that we have false negative, in cases where we could
check the constructor actually takes a const reference, or a copied by
value parameter.
* Add todo comment in isVariableMutableInInitializer
2020-01-04 11:36:45 +01:00
Paul Fultz II
e07801a891
Fix issue 9563: new daca crash: findLambdaEndToken not finding end token ( #2472 )
2020-01-04 10:45:24 +01:00
orbitcowboy
ce0f7e201d
Formatted 'wxwidgets.cfg: Added support for more interfaces.'
2020-01-04 00:26:39 +01:00
orbitcowboy
1e0f8ae9b4
Running astyle [ci skip].
2020-01-04 00:06:27 +01:00
Paul Fultz II
dd05839a7e
Fix false positives in knownConditionTrueFalse when using expressions with const variables ( #2469 )
2020-01-03 19:35:28 +01:00
Maksim Derbasov
fc5fd3c40c
Check that virtual function non-narrow access modifier in derived class ( #2229 )
...
* Check that virtual function has not narrowed access in derived class
* motivation info added
* error reporting moved to func
* added suppression for CI
2020-01-01 16:09:43 +01:00
Rikard Falkeborn
7514544d94
Fix #8758 (add syntax error for invalid code) ( #2466 )
2020-01-01 15:46:09 +01:00
Daniel Marjamäki
f23d880a7e
Verification; use <uninit> configuration
2020-01-01 14:37:20 +01:00
Paul Fultz II
30b9455e89
Fix issue 9556: FP mismatchingContainers: raw pointer comparison ( #2465 )
...
* Fix issue 9556: FP mismatchingContainers: raw pointer comparison
* Formatting
2020-01-01 12:02:21 +01:00
Daniel Marjamäki
d4ec8075a4
Verification; Fix false positive in while loops
2019-12-31 22:32:16 +01:00
Daniel Marjamäki
043634be27
Verification; Better handling of assignment in while
2019-12-31 20:31:31 +01:00
Daniel Marjamäki
446256a503
Verification; assume non-const pointer argument might point at uninitialized data
2019-12-31 17:51:58 +01:00
Dmitry-Me
895910b769
Fixed #7159 (wrong handling of function parameters)
2019-12-31 18:26:12 +03:00
Daniel Marjamäki
f55d72e821
Verification; uninitialized local variable
2019-12-31 14:57:42 +01:00
Daniel Marjamäki
3af3219076
Verification; Juliet *_float_* division by zero tests
2019-12-31 09:02:06 +01:00
Paul Fultz II
82c91f9484
Fix issue 9550: False positive: Same iterator is used with containers 'x' that are defined in different scopes ( #2463 )
2019-12-31 08:09:04 +01:00
Daniel Marjamäki
7dcfd3400f
Verification; test
2019-12-31 06:08:04 +01:00
Daniel Marjamäki
e4b29c6f98
Verification; minor tweak of testcase
2019-12-30 21:18:32 +01:00
Daniel Marjamäki
3ff31b799c
Verification: Use separate id for floating point division by zero
2019-12-30 19:50:22 +01:00
Daniel Marjamäki
4b5585e75b
Verification; floating point division by zero
2019-12-30 19:47:18 +01:00
Daniel Marjamäki
a60efa6774
Verification; Experimental checking for uninit
2019-12-30 18:55:16 +01:00
Daniel Marjamäki
6ea1875a84
Verification; Ensure assertions for variable type limits are added
2019-12-30 12:53:59 +01:00
Daniel Marjamäki
39a6eefef5
test/testsuites/danmar-verify: Added test cases
2019-12-30 09:44:49 +01:00
Daniel Marjamäki
29b599b0e5
Verification; callbacks in executeCast
2019-12-29 19:17:36 +01:00
Daniel Marjamäki
9723b28385
Verification; struct pointer member
2019-12-29 18:42:35 +01:00