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
Daniel Marjamäki
2710a94b4b
Verification; Merged handling of pointers and arrays
2019-12-29 16:26:11 +01:00
Paul Fultz II
75de485c4d
Fix issue 9551: Out-of-bounds in getLifetimeTokens() ( #2461 )
2019-12-29 08:23:58 +01:00
Daniel Marjamäki
ad352838c0
Verification; Add some more testcases
2019-12-28 22:23:11 +01:00
Wolfgang Stöggl
ad8bedebd7
Update cmake_minimum_required VERSION ( #2457 )
...
When tests are built, the minimum required cmake version is 3.4.
The file test/CMakeLists.txt uses cmake_policy(SET CMP0064 NEW),
which requires cmake 3.4 [1].
[1] https://cmake.org/cmake/help/v3.4/policy/CMP0064.html
2019-12-28 10:46:13 +01:00
Daniel Marjamäki
4b4f7ea60b
Verification; Updated report
2019-12-27 19:05:22 +01:00
Daniel Marjamäki
31bddb6ae0
astyle formatting
...
[ci skip]
2019-12-26 15:48:29 +01:00
Paul Fultz II
ce1fc56e96
Fix issue 6890: ValueFlow: min/max value for variable, after condition ( #2460 )
...
* Set bounds when combining values
* Adust bounds when they are negated
* Try to infer conditional values
* Switch false and true
* Fix checking of conditions
* Fix compare
* Fix remaining tests
* Fix overflows
2019-12-26 15:47:53 +01:00
Paul Fultz II
42d44f02a2
Use lifetime analysis for checking mismatching containers ( #2456 )
...
* Use lifetimes to check for mismatching containers
* Fix error messages
* Format
* Remove unused variables
* Fix configuration and track iterators through algorithms
* Fix iterator value types in qt config
* Fix library issue with QStringList
* Remove unused functions
* Fix cppcheck errors
2019-12-25 09:32:50 +01:00
Daniel Marjamäki
f0ac19514b
Verification: Handle Cppcheck annotations __cppcheck_low__ and __cppcheck_high__
2019-12-24 21:14:14 +01:00
Daniel Marjamäki
755e2d261c
Fixed #9402 (ExprEngine: && and || in condition)
2019-12-24 15:52:02 +01:00
Daniel Marjamäki
e16395e1e4
test/verify/itc.py: minor tweaks
2019-12-23 11:23:56 +01:00
orbitcowboy
2ca866f781
wxwidget.cfg: Added support for more interfaces.
2019-12-22 11:11:59 +01:00
Daniel Marjamäki
fe23d017f3
Fixed #8419 (False positive accessMoved on int)
2019-12-21 07:39:14 +01:00
Daniel Marjamäki
c2f8fb5603
Fixed #9405 (false positive: (style, inconclusive) Boolean expression 'dqOpen' is used in bitwise operation. Did you mean '&&')
2019-12-20 19:38:30 +01:00
Daniel Marjamäki
33ec78fe6e
Fixed #9036 (false positive: (style) Condition 's.x<127U' is always true)
2019-12-20 19:06:35 +01:00
Daniel Marjamäki
bd83630f2e
Fixed #8990 (False positive: struct member not used (union))
2019-12-20 18:31:55 +01:00
Dmitry-Me
9133f9fe75
Improve test coverage for function arguments count
2019-12-20 18:28:32 +03:00
Daniel Marjamäki
252c3a17fa
Fixed #7107 (False positive iterators - using alias for container)
2019-12-20 12:13:26 +01:00
Daniel Marjamäki
9ffb657c1a
Fixed #8597 (False positive - Array index is used before limits check.)
2019-12-20 09:46:01 +01:00
Daniel Marjamäki
02eaf6fa93
Fixed #8998 (False positive uninitStructMember related to reference to member)
2019-12-19 20:18:32 +01:00
Daniel Marjamäki
c84ba10b37
Fixed #8774 (Wrong handling of function with name 'or')
2019-12-19 19:22:39 +01:00
Daniel Marjamäki
235ef0a01e
Fixed #9420 (False positive - redundantInitialization)
2019-12-18 19:39:23 +01:00
IOBYTE
ec4c979cd8
fix daca error: Internal Error: Invalid syntax ( #2452 )
...
* fix daca error: Internal Error: Invalid syntax
* fix cppcheck warnings
2019-12-18 11:48:36 +01:00
Paul Fultz II
ad352daa08
Fix issue 9535: Syntax Error: AST broken, 'if' doesn't have two operands. ( #2450 )
2019-12-16 12:17:01 +01:00
Daniel Marjamäki
a241be0ecc
Fixed #9434 (False positive: Out of bounds access when using const pointer)
2019-12-15 20:10:28 +01:00
Daniel Marjamäki
36f369473e
isPointerDeref: Return false for function declarations
2019-12-15 16:36:46 +01:00
Daniel Marjamäki
aee9519d21
testsuite: Add x-flow tests
2019-12-15 13:57:27 +01:00
Daniel Marjamäki
f614d32d6a
Fixed #9519 (Syntax error on valid C++ 'enum {} (a)')
2019-12-15 08:40:04 +01:00
Daniel Marjamäki
bcfc5924fa
Fixed #9532 (False positive: Out of bounds access in expression 'v[0]' because 'v' is empty.)
2019-12-14 19:04:19 +01:00
Paul Fultz II
06752d75a5
Fix issue 9485: knownConditionTrueFalse false positive with integer constants ( #2447 )
...
* Fix issue 9485: knownConditionTrueFalse false positive with integer constants
* Formatting
2019-12-14 09:15:00 +01:00
IOBYTE
0e4efea530
fix #9539 (Syntax error for valid C++14 code) ( #2446 )
2019-12-12 20:50:20 +01:00
RobkeBaer
370196a14c
Fix extern c typedef syntax error ( #2438 )
...
* Fix extern c typedef syntax error
* Fix extraWhiteSpaceError
* Move test from testgarbage to testtokenize
2019-12-12 13:51:14 +01:00
Dmitry-Me
064795a705
Remove duplicate test
...
This partially reverts commit 047418dda1
2019-12-11 19:17:59 +03:00
Sebastian
6f2879a59b
errorlogger.cpp: Handle empty file-name like "*" (unmatchedSuppression) ( #2440 )
...
Using "--suppress=unmatchedSuppression" did not suppress the error-id in
all files, one needed to specify "*" as file-name. This commit also
allows empty file-names to suppress "unmatchedSuppression", not only "*"
or the exact file-name.
The manual uses the following example for suppressions specified in a
file:
// suppress all uninitvar errors in all files
uninitvar
This example suggests that no "*" has to be used to get suppression in
all files. I think that the command line parameter should work in the
same way.
2019-12-11 09:07:18 +01:00
Paul Fultz II
ad2f71338c
Fix issue 9525: Syntax Error: AST broken, 'if' doesn't have two operands inside lambda ( #2433 )
...
* Fix issue 9525: Syntax Error: AST broken, 'if' doesn't have two operands inside lambda
* Fix incorrect matchers
2019-12-10 21:21:07 +01:00
Sebastian
de4d44ae2f
opencv2.cfg: Add initial OpenCV 2.x API Library Configuration ( #2439 )
2019-12-10 19:34:30 +01:00
Paul Fultz II
4aa6385a97
Regression test for 9106: False positive duplicateCondition for struct member ( #2434 )
2019-12-09 06:51:58 +01:00
amai2012
f5df06a143
Run astyle [ci skip]
2019-12-08 11:22:19 +01:00
Paul Fultz II
ea2916a3e4
Fix issue 9514: Syntax Error: AST broken, 'for' doesn't have two operands. ( #2429 )
...
* Fix issue 9514: Syntax Error: AST broken, 'for' doesn't have two operands.
* Fix typo
2019-12-07 21:16:25 +01:00
Paul Fultz II
56e17fb228
Fix issue 9524: Syntax Error: AST broken, 'if' doesn't have two operands. ( #2432 )
2019-12-07 21:06:45 +01:00
Dmitry-Me
047418dda1
Improve test coverage for redundant bitwise operations
2019-12-06 19:14:03 +03:00
Sebastian
95e0b0d0f9
Fix #9510 : Crash in valueflow.cpp solveExprValues() (division by zero) ( #2420 )
...
`break` if divider `intval` is 0 to avoid division by 0 as suggested by @pfultz2
Trac ticket: https://trac.cppcheck.net/ticket/9510
2019-12-06 08:08:40 +01:00
IOBYTE
f637d97080
Fix 9509 (Syntax error on empty attribute list) ( #2423 )
2019-12-06 05:17:19 +01:00
Paul Fultz II
2978c67e6f
Fix issue 9511: Syntax Error: AST broken, 'if' doesn't have two operands. ( #2428 )
2019-12-06 04:19:46 +01:00
IOBYTE
5979eec2c0
Fix 9518 (Syntax error on valid C++) ( #2424 )
2019-12-05 20:51:36 +01:00
Dmitry-Me
7da68bff7b
Improve test coverage for missing destructors
2019-12-05 18:25:50 +03:00
Dmitry-Me
571de5844f
Improve test coverage for functions returning bool values
2019-12-04 18:12:10 +03:00
John Marshall
297efcd049
Avoid some additional memleakOnRealloc false positives ( #2422 )
...
* Avoid some additional memleakOnRealloc false positives
checkReallocUsage() already contains code to suppress the
`p = realloc(p, size)` error message when the pointer has been
previously copied from another variable (hence there is an additional
copy of the original pointer value) within the same function, as in
the added realloc21() test case.
Extend this so that `p = *pp` and `p = ptr->foo` are also recognized
as copies from another variable with the same original pointer value,
as in the added realloc22() and realloc23() test cases.
* Rewrite as a single findmatch() expression
2019-12-04 12:13:44 +01:00
Dmitry-Me
cf7ef2e703
Valid code for incrementing raw pointer ( #2418 )
2019-12-03 18:33:05 +01:00
Paul Fultz II
36977becba
Fix issue 9196: Lambda confuses check ( #2415 )
2019-12-03 18:30:52 +01:00
Dmitry-Me
b14a976c6c
Improve test coverage for postfix increment of raw pointers
2019-12-02 18:12:14 +03:00
Paul Fultz II
78b4485670
Regression for issue 8653: valueFlowAfterCondition: compound conditional ( #2416 )
2019-12-02 11:35:51 +01:00
Paul Fultz II
9cb39b1d7e
Fix issue 9482: False positive: Reference to temporary returned using trailing return type ( #2413 )
2019-12-01 15:10:02 +01:00
Paul Fultz II
f77347d7b4
Fix crash 9492: Crash in FwdAnalysis::checkRecursive() (condTok is nullptr) ( #2411 )
...
* Fix crash 9492: Crash in FwdAnalysis::checkRecursive() (condTok is nullptr)
* Formatting
2019-12-01 14:53:03 +01:00
Paul Fultz II
a71f58ffc2
Fix issue 9441: false positive: new(std::nothrow) and nullPointerRedundantCheck ( #2403 )
...
* Fix issue 9441: false positive: new(std::nothrow) and nullPointerRedundantCheck
* Skip new if it is a variable
2019-12-01 12:16:31 +01:00
Paul Fultz II
79a2e61721
Fix issue 6850: Valueflow: pointer alias, conditional value ( #2402 )
2019-11-30 09:22:03 +01:00
Paul Fultz II
f9d33c07f8
Fix issue 9458: Crash with shadow variables in a lambda ( #2406 )
...
* Fix issue 9458: Crash with shadow variables in a lambda
* Format
2019-11-29 09:45:02 +01:00
IOBYTE
f554a71dea
fix #9495 (Crash when parsing angle brackets in template with type traits (assertion failure)) ( #2407 )
2019-11-29 09:44:27 +01:00
Daniel Marjamäki
676a837af6
Fixed #9335 (FP constStatement "Found a statement that begins with string constant")
2019-11-28 17:49:33 +01:00
Dmitry-Me
ff36ebcff2
Improve test coverage for testing AST
2019-11-28 18:11:55 +03:00
Sebastian
fd900ab8b2
testnullpointer.cpp: Add test for dereferencing returned NULL pointer ( #2401 )
...
This adds a regression test to make sure that directly dereferencing a
returned NULL pointer issues a warning.
This has been asked on Stack Overflow:
https://stackoverflow.com/q/58981369
Cppcheck 1.89 does not warn for such a code, but 1.90 dev does. So it
is a good idea to make sure it is detected in the future too I guess.
2019-11-27 19:41:36 +01:00
Dmitry-Me
8af2ee968e
Fix incorrect usage of "unlikely" hint
2019-11-27 18:08:10 +03:00
Dmitry-Me
45e617f50b
Fix -Wint-conversion warning
2019-11-27 18:08:10 +03:00
Daniel Marjamäki
937c82efbe
AST: initializer list with lambda
2019-11-27 06:44:58 +01:00
Dmitry-Me
8f72a714d1
Fix -Wint-conversion warning
2019-11-26 18:03:47 +03:00
Sebastian
c3c3d6770c
Fix #9478 : Valueflow: printf does not change value ( #2388 )
...
Format-string arguments are now marked to have `in` direction, except
for `scan`-functions (like `scanf`) where these arguments are explicitly
marked to have `out` direction.
2019-11-24 01:40:31 +01:00
Daniel Marjamäki
ab2274b8ad
AST: lambdas and scopes in expressions
2019-11-23 21:36:36 +01:00
Daniel Marjamäki
ebd32cfd73
Syntax error: if (retval==)
2019-11-23 18:50:46 +01:00
IOBYTE
fb1d60bfb1
fix syntax error for num.operator std::string()[0] ( #2389 )
2019-11-23 17:42:24 +01:00
Dmitry-Me
5a48ac0c6e
Improve test coverage for invalid use of bool parameters
2019-11-22 18:11:38 +03:00
IOBYTE
df952926f8
fix syntax error for a.operator++() ? a.operator--() : 0 ( #2382 )
2019-11-20 22:13:32 +01:00
Dmitry-Me
98488790a1
Improve test coverage for %jd used with scanf()
2019-11-20 18:10:56 +03:00
IOBYTE
590aeea8f8
Fix #9483 (Assertion `tok && tok->str() == ">"' failed) ( #2381 )
2019-11-20 07:02:25 +01:00
Rikard Falkeborn
f6a2034a4c
Add regression tests for fixed crashes ( #2379 )
...
The invalid code in Trac tickets #8750 , #8753 , #8756 , #8762 , #8764
and #8765 previously crashed cppcheck. Now it throws a syntax error
instead. Add some tests for these tickets.
2019-11-19 21:50:53 +01:00
Armin Müller
130ebe4b85
Typos found by running "codespell" ( #2380 )
2019-11-19 20:02:24 +01:00
Dmitry-Me
cfac54c42a
Improve test coverage for %I32d used with scanf()
2019-11-19 18:05:21 +03:00
Paul Fultz II
479fbb85a2
Fix issue 9443: Internal error: Token::astOperand2() cyclic dependency. ( #2376 )
...
* Improve nested init lists
* Fix issue 9443: Internal error: Token::astOperand2() cyclic dependency.
2019-11-19 11:38:03 +01:00
Dmitry-Me
55051b777b
Remove unneeded string copy
2019-11-19 10:19:13 +03:00
orbitcowboy
2ff18b76ec
test std.cfg: Improved tests for strncpy and strrchr .
2019-11-18 13:53:42 +01:00
orbitcowboy
d5d2915873
test std.cfg: Improved tests for strncmp and strncat.
2019-11-18 13:43:49 +01:00
Paul Fultz II
ed1acc319d
Fixx issue 9355: FP constParameter when returning non-const reference to struct member ( #2373 )
2019-11-18 06:39:50 +01:00
IOBYTE
7f6ebaa6b2
fix syntax error for VTK_LEGACY_BODY(vtkMatrix3x3::operator[], "VTK 7.0"); ( #2372 )
2019-11-18 06:38:53 +01:00
Daniel Marjamäki
f5e3dc9a38
Improved fix for #8978 (False positive: Variable assigned value that is never used when assigning via iterator)
2019-11-17 12:08:21 +01:00
Paul Fultz II
4ebf54d090
Fix issue 9437: Dont assume init list constructor for strings ( #2366 )
...
* Fix issue 9437: Dont assume init list constuctor for strings
* Update the schema
* Add documentation
2019-11-17 03:22:04 +01:00
Daniel Marjamäki
5654630099
Fixed #8978 (False positive: Variable assigned value that is never used when assigning via iterator)
2019-11-16 19:49:54 +01:00
Daniel Marjamäki
7cd7aff60a
Fixed #9285 (Misleading warning message)
2019-11-16 17:24:54 +01:00
Daniel Marjamäki
bae4faa786
Fixed #9422 (FP uninitdata - writing pointer to output stream)
2019-11-16 11:47:57 +01:00
IOBYTE
754c1fff66
fix syntax error for conversion operator for type with global namespace ( #2365 )
...
* fix syntax error for conversion operator for type with global namespace
* fix syntax error when taking address of operator function
* fix syntax error for using ::operator "" _a;
* fix syntax error for template<> void operator "" _h<'a', 'b', 'c'>() {}
* fix syntax error for operator in parentheses
2019-11-16 08:03:13 +01:00
IOBYTE
3a617fa04a
Fix #9472 (Syntax error on valid C++ code) ( #2363 )
...
There are probably a lot more valid code patterns that generates syntax
errors so I added "operator" to the error message to make it easier to
find them.
2019-11-15 07:03:57 +01:00
Daniel Marjamäki
7e0fc4fb00
Tokenizer: Detect more syntax errors when operator does not have operands
2019-11-14 21:18:31 +01:00
orbitcowboy
dbbb7f544a
test std.cfg: Improved strlen() tests.
2019-11-14 16:45:27 +01:00
orbitcowboy
ea92695e54
test std.cfg: Improved sscanf() tests.
2019-11-14 16:38:30 +01:00
orbitcowboy
ade54bef3f
test std.cfg: Added better tests.
2019-11-14 10:48:23 +01:00
IOBYTE
2eb575d990
Fix #9468 (Syntax error on valid C++) ( #2358 )
2019-11-14 09:26:21 +01:00