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
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
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
Paul Fultz II
6ea4f60600
Enable valueFlowSubfunction for multiple parameters ( #2550 )
2020-03-01 16:46:20 +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
Paul Fultz II
921887a281
Use valueFlowGeneric for valueFlowForwardExpression ( #2537 )
2020-02-16 16:02:22 +01:00
Paul Fultz II
7368a54629
Add generic valueflow forward analysis ( #2511 )
2020-02-13 16:27:06 +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
Daniel Marjamäki
36f369473e
isPointerDeref: Return false for function declarations
2019-12-15 16:36:46 +01:00
Paul Fultz II
36977becba
Fix issue 9196: Lambda confuses check ( #2415 )
2019-12-03 18:30:52 +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
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
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
Paul Fultz II
6f29e299fc
Fix issue 9439: false positive: unique_ptr and nullPointerRedundantCheck ( #2346 )
2019-11-10 09:44:59 +01:00
Paul Fultz II
c75bbbe253
Fix issue 9404: False positive: Either the condition 'if(x)' is redundant or there is possible null pointer dereference: a->x ( #2322 )
...
* Fix issue 9404: False positive: Either the condition 'if(x)' is redundant or there is possible null pointer dereference: a->x
* Use simpleMatch
* Add a test case for the FP
* Check if expression is changed
* Check for no return scope
* Use simpleMatch
2019-11-08 08:11:41 +01:00
Paul Fultz II
acd2a92efc
Fix issue 9395 and 9423: False positive: nullPointerRedundantCheck ( #2323 )
2019-11-04 07:02:25 +01:00
Daniel Marjamäki
78c02f0505
ValueFlow: Fixed false positives after escape scope
2019-10-20 20:57:16 +02:00
Daniel Marjamäki
e50b9e2bef
Fixed #8784 (False positive uninitialized variable)
2019-10-20 15:20:05 +02:00
orbitcowboy
f05e21efa8
Formatted the code, there are no functional changes [ci skip].
2019-10-01 08:39:08 +02:00
Paul Fultz II
166bd2bafc
Fix issue 2153: valueFlowAfterCondition: struct member ( #2228 )
...
* Fix issue 2153: valueFlowAfterCondition: struct member
* Fix null pointer dereference
* Formatting
* Check for another null pointer
* Initialize variables
* Remove redundant condition
* Format
* Add missing initialization to copy constructor
* Format
2019-09-30 21:04:43 +02:00
Daniel Marjamäki
049f6475ee
astyle formatting
...
[ci skip]
2019-09-20 15:07:27 +02:00
Paul Fultz II
ad8abdb0c3
Add impossible values to ValueFlow ( #2186 )
...
* Add impossible category
* Replace values
* Try to adjust known values
* Add ! for impossible values
* Add impossible with possible values
* Remove contradictions
* Add values when the branch is not dead
* Only copy possible values
* Dont bail on while loops
* Load std lib in valueflow
* Check for function calls
* Fix stl errors
* Fix incorrect impossible check
* Fix heap-after-use error
* Remove impossible values when they are lowered
* Show the bound and remove overlaps
* Infer conditions
* Dont push pointer values through dynamic_cast
* Add test for dynamic_cast issue
* Add shifttoomanybits test
* Add test for div by zero
* Add a test for issue 9315
* Dont make impossible value inconclusive
* Fix FP with shift operator
* Improve handleKnownValuesInLoop for impossible values
* Fix cppcheck warning
* Fix impossible values for ctu
* Bailout for streams
* Check equality conditions
* Fix overflows
* Add regression test for 9332
* Remove duplicate conditions
* Skip impossible values for invalid value
* Check for null
* Rename bound to range
* Formatting
2019-09-20 15:06:37 +02:00
Paul Fultz II
9ef64eb33e
Add regression test for issue 9264: FP nullPointerRedundantCheck - pointer alias ( #2133 )
2019-09-01 09:58:53 +02:00
Paul Fultz II
9aa97cbb95
Fix issue 8296: ValueFlow: value not set in conditional scope in subfunction ( #2071 )
...
* Fix issue 8296: ValueFlow: value not set in conditional scope in subfunction
* Refactor condition checkingg
* Make test case TODO
2019-08-11 15:39:37 +02:00
Paul Fultz II
bd02ca5ccb
Fix issue 9207: Not detected 'always true' and unreachable code
2019-08-08 07:46:47 +02:00
Paul Fultz II
aaeec462e6
Re-enable valueFlowSubFunction ( #2063 )
...
* Re-enable valueFlowSubFunction
* Formatting
* Skip ternary operators in subfunctions
* Fix test with iostreams
* Fix FP with multiple parameters
2019-08-05 16:26:32 +02:00
Paul Fultz II
ab0fcc7640
Fix issue 9216: reset() method confusion ( #2025 )
...
* Fix issue 9216 with smart pointer reset
* Check for arrow
2019-07-23 22:45:58 +02:00
Daniel Marjamäki
57c6628732
Revert 'Cleaning up unsimplified templates'. This fix caused problems.
2019-05-16 21:11:04 +02:00
Daniel Marjamäki
d58d4273f9
Cleaning up unsimplified templates
2019-05-11 13:00:03 +02:00
Paul Fultz II
a688df0ea1
Fix issue 9120: crash in valueflow ( #1822 )
2019-05-05 09:51:36 +02:00
Paul Fultz II
39f4374446
Improve diagnostics with null smart pointers ( #1805 )
...
* Warn when dereferencing null smart pointers
* Improve tracking of smart pointer values
* Use library isSmartPointer
2019-04-26 11:30:09 +02:00
Daniel Marjamäki
b0c92c1ac1
CheckNullPointer: Use library instead of hardcoding
2019-03-17 07:37:38 +01:00
Daniel Marjamäki
3dc34f1515
Disable all simplified checks
2019-03-16 09:17:50 +01:00
Daniel Marjamäki
4f5a426fe5
Improved isVariableChangedByFunctionCall, better logic when parameter might be passed by reference
2019-02-28 17:02:46 +01:00
Kamil Dudka
21c22d0d4d
TestNullPointer: add regression test to cover #8813 ( #1699 )
...
... which is fixed since 1.86-72-gbc34f0239
2019-02-26 17:14:45 +01:00
Daniel Marjamäki
bd7790fd8c
Update copyright year
2019-02-09 07:24:06 +01:00
amai2012
738fef6c27
Run astyle
2019-01-12 21:51:39 +01:00
Daniel Marjamäki
8dd641b8be
Use OVERRIDE in test
2019-01-12 15:45:25 +01:00
Daniel Marjamäki
aa4f61acdf
CTU: Avoid FP in else block
2018-12-31 08:24:39 +01:00
Daniel Marjamäki
fb6a291370
CTU: Avoid FP in code protected by &&,||,?
2018-12-31 08:16:21 +01:00
Daniel Marjamäki
91a580cbd7
CTU: more warnings
2018-12-30 18:31:37 +01:00
Daniel Marjamäki
c8901e9bab
CTU: Find paths better
2018-12-30 16:23:25 +01:00
Daniel Marjamäki
d18f5d8709
CTU: Reuse CheckNullPointer::isPointerDeRef in the nullpointer isUnsafeUsage
2018-12-29 09:26:57 +01:00
Daniel Marjamäki
271763e680
CTU: Refactoring
2018-12-25 21:11:23 +01:00
Daniel Marjamäki
a1dca6acd5
Fix CTU nullpointer check
2018-12-25 12:04:01 +01:00
Daniel Marjamäki
bc34f0239d
Disable the subfunction value flow analysis. It does not work well and needs to be rewritten. There are false positives.
2018-12-18 14:36:49 +01:00