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
Paul
450bdfedf3
Fix FP of duplicateCondition when modifying the this variable
2020-07-13 12:40:01 -05: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
Paul
caabe56f14
Handle FPs: mutexes being locked at different scopes
2020-07-12 21:31:53 -05:00
Ken-Patrick Lehrmann
61ccf888b3
Fix some false positives when the same expression at different places does not have the same value
...
Typically with
```
int F(int *f);
void F2(int *a, int *b) {
int c = *a;
F(a); // modifies *a
if (b && c != *a) {}
}
```
we would get the following FP:
```
[test.cpp:3] -> [test.cpp:5]: (style) The comparison 'c != *a' is always false because 'c' and '*a' represent the same value.\n
```
I guess it boils down to isSameExpression only checking that the
expression is the same (in the above case, "*a" and "*a" are indeed the
same), but there's not real check on the values.
So the patch here is a bit hackish, and we still have false negatives in
cases with dereferenced pointers.
2020-07-11 14:13:18 +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
Paul
edcf668ae2
Update test mesg
2020-06-29 10:15:36 -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
Paul
d5b6d49d96
Fix issue 9578: false negative: (style) Condition '...' is always false
2020-06-28 15:28:08 -05: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
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