Daniel Marjamäki
418eb43d45
Fixed #9032 (False-positive detection of reassigned value before used for pointer parameter)
2019-03-23 19:01:02 +01:00
Daniel Marjamäki
d82c792c1b
astyle formatting
2019-03-23 19:00:03 +01:00
Daniel Marjamäki
a9082c902a
Fixed #9058 (crash on invalid code in FwdAnalysis::checkRecursive)
2019-03-23 18:27:41 +01:00
Daniel Marjamäki
d6b806c592
CheckBufferOverrun: Better CTU checking when variable address is passed
2019-03-23 15:57:17 +01:00
Daniel Marjamäki
d27a4ad82e
CheckBufferOverrun: Fix ctu checking
2019-03-23 15:26:13 +01:00
Daniel Marjamäki
9653760547
CheckBufferOverrun: Improved CTU analysis for array
2019-03-23 11:20:35 +01:00
IOBYTE
40af889df0
Fixed #9053 (simplifyTypedef: wrong simplification of '(const d)' when 'd' is a array) ( #1751 )
...
* Fixed #9053 (simplifyTypedef: wrong simplification of '(const d)' when 'd' is a array)
* fix whitespace
2019-03-23 10:45:38 +01:00
Pavol Misik
7c7ee66cf9
Fix crash in TemplateSimplifier::TokenAndName::TokenAndName in case of template constexpr ( #1748 )
...
This is not propper solution. This change just eliminates crash and logs error.
https://trac.cppcheck.net/ticket/9046
2019-03-23 10:42:41 +01:00
Daniel Marjamäki
a135683d2f
Refactoring; Renamed CWE786 and CWE788
2019-03-23 08:41:20 +01:00
Daniel Marjamäki
15fc9a622d
CheckBufferOverrun: Add CTU analysis
2019-03-23 08:36:10 +01:00
Paul Fultz II
91138578cc
Fix 9052: Crash: SIGSEGV in Token::previous (this=0x0) while checking mariadb-10.0
2019-03-22 01:56:09 +01:00
Daniel Marjamäki
55433fce40
Library: added bufferSize parameters
2019-03-20 19:26:57 +01:00
Daniel Marjamäki
14528bcf25
Library: allowed values for the buffer-size attribute: malloc/calloc/strdup
2019-03-20 06:46:55 +01:00
Daniel Marjamäki
031362ae01
CheckBufferOverrun: Fix false positive
2019-03-19 21:07:08 +01:00
Daniel Marjamäki
6cbe818f1a
Fix uninitialized variable usage
2019-03-19 13:17:27 +01:00
Daniel Marjamäki
a0e58f0039
Revert "Revert "CheckBufferOverrun: Handle multidimensional arrays""
...
This reverts commit 9d1755f449
.
2019-03-19 13:16:22 +01:00
Daniel Marjamäki
9d1755f449
Revert "CheckBufferOverrun: Handle multidimensional arrays"
...
This reverts commit e98a4a6f14
.
2019-03-19 13:13:29 +01:00
Daniel Marjamäki
e98a4a6f14
CheckBufferOverrun: Handle multidimensional arrays
2019-03-19 09:29:32 +01:00
Paul Fultz II
774464eabb
Fix issue 8996: False positive duplicateCondition
...
This fixes issue 8996 by improving the alias checking by using lifetime analysis. It also extends the lifetime checker to handle constructors and initializer lists for containers and arrays.
2019-03-19 06:25:10 +01:00
Rikard Falkeborn
794f65bac1
Handle prefixed strings and characters in Token ( #1742 )
...
This makes it possible to call getStrLength() and similar functions
before the tokenizer is called.
2019-03-18 06:18:25 +01:00
Daniel Marjamäki
b53a2e5dc4
CheckBufferOverrun: restore minsize code
2019-03-17 20:34:49 +01:00
Daniel Marjamäki
03f8535c71
Better multiline warning when there is buffer overflow
2019-03-17 20:12:02 +01:00
Daniel Marjamäki
3c85d8a8ac
ValueFlow: Better info for buffer size values
2019-03-17 19:02:36 +01:00
Sebastian
19e9e42dd7
Library: Enhance minsize configuration and allow simple values. ( #1736 )
...
Some POSIX and Windows functions require buffers of at least some
specific size. This is now possible to configure via for example this
minsize configuration: `<minsize type="value" value="26"/>`.
The range for valid buffer size values is 1 to LLONG_MAX
(9223372036854775807)
2019-03-17 14:22:26 +01:00
Daniel Marjamäki
0771929518
Buffer overflow: Handling of dynamically allocated buffer
2019-03-17 13:40:56 +01:00
Daniel Marjamäki
92f4113b59
Array index: Checking array index out of bounds for dynamic buffers
2019-03-17 13:09:15 +01:00
Daniel Marjamäki
18668a52b9
Library: Added buffer-size attribute for <alloc>
2019-03-17 10:55:15 +01:00
Daniel Marjamäki
a3257349b9
astyle formatting
...
[ci skip]
2019-03-17 10:50:06 +01:00
Daniel Marjamäki
c7155a8e08
Removed '--experimental-fast' flag
2019-03-17 08:19:56 +01:00
Daniel Marjamäki
b0c92c1ac1
CheckNullPointer: Use library instead of hardcoding
2019-03-17 07:37:38 +01:00
Daniel Marjamäki
87fe5c060e
Refactoring of Null Pointer Checker
2019-03-16 21:21:30 +01:00
Daniel Marjamäki
d0c1632b51
Fix CheckBufferOverrun::array_index_12 when compiling with VS
2019-03-16 19:41:13 +01:00
Daniel Marjamäki
3dc34f1515
Disable all simplified checks
2019-03-16 09:17:50 +01:00
Daniel Marjamäki
0e88a17aca
CheckInternal: Use 'normal' checking
2019-03-16 08:51:33 +01:00
Daniel Marjamäki
f40a80c349
Use 'normal' checking instead of 'simplified'
2019-03-16 07:19:48 +01:00
Daniel Marjamäki
a2a216bbe3
SymbolDatabase: Improved handling of 'normal' non simplified token list
2019-03-15 19:00:42 +01:00
Daniel Marjamäki
92485245ce
Restore severity for 'autoVariables'
2019-03-15 15:13:11 +01:00
Sebastian
08d41ab8af
Load std.cfg before all other libraries ( #1740 )
...
- CLI: Save the libraries that should be loaded to a list and load them
after the std.cfg has been loaded.
- GUI: Load std.cfg (and windows.cfg / posix.cfg when applicable) before
setting other options and loading the other libraries.
In the project-file-dialog the std.cfg is searched first. If some
other library fails to load is is retried with first loading std.cfg.
- boost.cfg: Enable containers that depend on std containers.
2019-03-15 06:59:37 +01:00
Paul Fultz II
3615eac347
Move useStlAlgorithm to normal checking ( #1741 )
2019-03-15 06:15:56 +01:00
Daniel Marjamäki
a1ade2dd7d
Refactoring: Use range for
2019-03-14 19:57:58 +01:00
Daniel Marjamäki
56c47fc6ed
Refactoring: use continue
2019-03-14 19:53:45 +01:00
Daniel Marjamäki
3656f1ae4f
Auto variables: Fix false negatives for normal tokens
2019-03-14 13:51:35 +01:00
Daniel Marjamäki
6eeee743d2
Auto variables: Minor cleanup
2019-03-14 06:41:11 +01:00
Daniel Marjamäki
b984897526
ValueFlow: Fix sizeof for array of library type
2019-03-13 18:31:41 +01:00
Daniel Marjamäki
2ecfae0a98
CheckBufferOverrun: the bufferNotZeroTerminated did not work well, hide that for now
2019-03-13 06:45:01 +01:00
Daniel Marjamäki
81a1d744c6
CheckBufferOverrun: fix FP for array definition of static class member
2019-03-13 06:39:09 +01:00
Daniel Marjamäki
67e8b99c2c
CheckBufferOverrun: Readd a check for strncpy/memcpy/etc
2019-03-12 21:15:26 +01:00
Daniel Marjamäki
2a00667609
CheckBufferOverrun: cleanup
2019-03-12 18:58:14 +01:00
Daniel Marjamäki
11e32ff445
ValueFlow: Handle compound assignments in execute()
2019-03-12 18:53:58 +01:00
Daniel Marjamäki
0c08f6db6c
CheckBufferOverrun: Use AST to lookup array
2019-03-12 06:46:38 +01:00
Daniel Marjamäki
4ababeb704
Fix 'make checkcfg'
2019-03-11 21:39:39 +01:00
Daniel Marjamäki
ea23033a65
Array index out of bounds: Fix false positive
2019-03-11 20:33:08 +01:00
Daniel Marjamäki
7b17b33a49
ValueFlow: fix handling of sizeof(*p)
2019-03-11 20:32:24 +01:00
Daniel Marjamäki
17253cdb55
buffer overflow: Fix false positive
2019-03-11 19:40:17 +01:00
Daniel Marjamäki
bd048085bd
Add CheckBufferOverrun::arrayIndexThenCheck
2019-03-11 19:20:06 +01:00
Daniel Marjamäki
a933261e14
Add message id arrayIndexOutOfBoundsCond
2019-03-11 19:12:03 +01:00
orbitcowboy
0721c9f7f0
Running astyle [ci skip].
2019-03-11 15:32:30 +01:00
Daniel Marjamäki
729f57d8f1
Start a major rewrite of CheckBufferOverrun. For now only the 'array index' and 'buffer overflow' checks are rewritten.
...
There are important TODOs still; for instance adding CTU support using our CTU infrastructure, add handling of pointers (maybe I'll use FwdAnalysis for this), add handling of multidimensional arrays, etc..
2019-03-11 12:34:33 +01:00
Daniel Marjamäki
34711bcb93
Remove unused functions
2019-03-11 12:23:22 +01:00
Daniel Marjamäki
df8cfe2fc6
Travis: Fix Cppcheck warning
2019-03-10 12:24:41 +01:00
Rikard Falkeborn
6a3dd9a185
Handle concatenated string and char literals
...
This handles concatenated strings and characters from simplecpp.
Previously, L'c' would be preprocessed to the tokens "L" and "'c'".
cppcheck would then remove the "L" token and set "'c'" to be a wide
character literal. Now, it needs to remove the prefix instead.
When doing this, add handling of utf32 encoded literals (U) and UTF-8
encoded literals (u8).
2019-03-10 10:38:50 +01:00
Daniel Marjamäki
3eb5de756c
Buffer overrun: Refactorings; use range for loops and write in message
2019-03-09 22:19:09 +01:00
Daniel Marjamäki
4ce6de39c5
CheckCondition: Moved checks to 'normal'
2019-03-09 22:00:59 +01:00
Daniel Marjamäki
ea9b2032c1
CheckClass: Moved checks to 'normal'
2019-03-09 21:38:36 +01:00
Daniel Marjamäki
69c05acd3b
CheckBoost: Use 'normal' checking
2019-03-09 20:00:31 +01:00
Daniel Marjamäki
5a42c54d0f
CheckBool: Use normal checking
2019-03-09 19:16:07 +01:00
Daniel Marjamäki
ac42382cd9
Rewrite CheckBool::checkAssignBoolToPointer to use ValueType
2019-03-09 19:15:06 +01:00
Daniel Marjamäki
e17ddfd964
Changed AST for variable declarations with initializations
2019-03-09 19:09:15 +01:00
Daniel Marjamäki
1b4895a579
ValueType: Set ValueType for false/true
2019-03-09 17:27:27 +01:00
Daniel Marjamäki
5a32d2d017
Moved CheckAutoVariables::autoVariables to normal checking
2019-03-09 16:53:43 +01:00
Daniel Marjamäki
38d5712aaa
Moved CheckAssert::assertWithSideEffects to normal checking
2019-03-09 16:50:50 +01:00
Daniel Marjamäki
b9ac77a31b
Uninitialized variables: Fixed false positive
2019-03-09 11:30:45 +01:00
Daniel Marjamäki
f36ca56e7d
Moved CheckStl::redundantCondition to normal checking
2019-03-09 07:53:49 +01:00
Daniel Marjamäki
f9fe6cc96a
STL: Removed auto_ptr checking.
2019-03-09 07:48:01 +01:00
Daniel Marjamäki
d7a645dcc3
Moved CheckStl::uselessCalls to normal checking
2019-03-09 07:37:08 +01:00
Rikard Falkeborn
a53b016414
checknullpointer: Remove duplicated include ( #1732 )
2019-03-08 20:55:09 +01:00
Daniel Marjamäki
45a0c2ebf5
Revert "Moved CheckStl::checkAutoPointer to normal checking"
...
This reverts commit 6dc9727ffd
.
2019-03-08 20:53:37 +01:00
Daniel Marjamäki
6dc9727ffd
Moved CheckStl::checkAutoPointer to normal checking
2019-03-08 20:41:28 +01:00
Daniel Marjamäki
95a20c0233
Moved CheckStl::string_c_str to normal checking
2019-03-08 20:39:43 +01:00
Daniel Marjamäki
fdf1d6fdee
Moved CheckStl::erase to normal checking
2019-03-08 20:36:40 +01:00
Daniel Marjamäki
fdfe39299c
Moved CheckStl::pushback to normal checking
2019-03-08 20:33:16 +01:00
Daniel Marjamäki
5fe48f3cd2
Moved CheckStl::mismatchingContainers to normal checking
2019-03-08 20:31:00 +01:00
Daniel Marjamäki
b91bb2e523
Moved CheckStl::iterators to normal checking
2019-03-08 20:28:28 +01:00
Daniel Marjamäki
8f2d70e61d
Move CheckStl::if_find to normal checking
2019-03-08 20:23:37 +01:00
Daniel Marjamäki
725abbfac3
Move CheckStl::missingComparison to normal checks
2019-03-08 20:19:40 +01:00
Daniel Marjamäki
75ce67f4b8
Fixed #9027 (cppcheck on Centos 7 - segmentation fault below CheckCondition::multiCondition2)
2019-03-08 19:27:20 +01:00
Sebastian
c8003d47e2
checkuninitvar.cpp: Use argument direction "out" info from library cfg ( #1730 )
...
CheckUninitVar::isMemberVariableAssignment uses argument direction "out"
now also to check for assignment when the member variable is handed over
to a function by reference.
testuninitvar.cpp: Improve tests, use a test library configuration.
2019-03-08 18:42:24 +01:00
amai2012
eb9edbc177
#9024 Crash caused by package "procserv" in lib/token.h:921 function Token::getKnownIntValue - Fix and test for alternative code example.
2019-03-08 11:07:33 +01:00
Daniel Marjamäki
6eaf2c03d9
CheckOther::checkInvalidFree: Move check to normal checking. And clarify the message.
2019-03-07 06:35:44 +01:00
Daniel Marjamäki
17e73fd144
Move CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse to Normal checking
2019-03-06 21:27:19 +01:00
Daniel Marjamäki
f20936ed8a
Moved CheckOther::checkPassByReference to normal checking
2019-03-06 20:59:45 +01:00
Daniel Marjamäki
9d5f672dbc
Unused struct member: Fix FPs seen in daca@home results for template structs
2019-03-06 20:51:48 +01:00
Daniel Marjamäki
572d7eb86c
Moved CheckOther::clarifyCalculation to normal checking
2019-03-06 20:43:28 +01:00
Daniel Marjamäki
ee9053f219
Moved CheckOther::checkRedundantCopy() to normal checking
2019-03-06 20:38:13 +01:00
Sebastian
6228ea2266
checkuninitvar.cpp: Use argument direction info from library config. ( #1728 )
...
CheckUninitVar::isMemberVariableAssignment uses argument direction
to check for assignment when the member variable is handed over to a
function by reference. Currently implemented for "in" direction. "out"
will be added with another commit.
2019-03-06 19:26:38 +01:00
Daniel Marjamäki
ad37664e86
Changed severities
2019-03-06 19:00:58 +01:00
Daniel Marjamäki
c32d015337
Fixed false positives from terminateStrncpy
2019-03-06 18:50:50 +01:00
Daniel Marjamäki
3f37d5ac2d
Refactoring strncpy/strncat checking to use ValueFlow and AST
2019-03-06 09:04:04 +01:00
Daniel Marjamäki
37814513f8
Revert "Moved all simplified CheckOther checks from simplified to normal checking"
...
This reverts commit 2900690881
.
2019-03-06 07:08:56 +01:00
Daniel Marjamäki
2900690881
Moved all simplified CheckOther checks from simplified to normal checking
2019-03-06 06:33:51 +01:00
Daniel Marjamäki
06c2019676
Moved CheckOther::checkPipeParameterSize from simplified to normal checking
2019-03-06 06:28:13 +01:00
Carlo Marcelo Arenas Belón
cb973cbb7b
lib: reorders settings to match definition (-Wreorder) ( #1727 )
...
lib/settings.cpp:53:7: warning: field 'removeUnusedIncludedTemplates' will be
initialized after field 'removeUnusedTemplates' [-Wreorder]
removeUnusedIncludedTemplates(false),
^
lib/settings.cpp:54:7: warning: field 'removeUnusedTemplates' will be
initialized after field 'checkConfiguration' [-Wreorder]
removeUnusedTemplates(false),
^
2019-03-06 06:12:02 +01:00
Daniel Marjamäki
fda0f52424
Add --remove-unused-templates flag to remove all unused templates
2019-03-05 14:58:02 +01:00
IOBYTE
5ee6c2138c
Fixed #9016 (tokenizer: wrong simplification for operator ^ (){}) ( #1724 )
2019-03-05 11:35:45 +01:00
Sebastian
0934577dda
Library configuration: function argument direction fixes and enhancements ( #1722 )
...
* std.cfg: Add further argument directions (in, out, inout).
* testlibrary.cpp: Add test for function argument direction configuration.
* std.cfg: runastyle and add some more direction configurations.
* library.h: Add documentation for function argument direction enum.
* Do not use "direction" library information for pointer arguments.
Also fix further unmatched uninitvar messages in std configuration
tests.
* std.cfg: Add more argument direction configurations.
* test/cfg/std.c: Add test for argument direction configuration.
* astutils.cpp: Only ignore pointer arguments for out/inout arguments.
* library.h: Use suggested documentation for argument direction enum.
2019-03-04 22:57:40 +01:00
Daniel Marjamäki
3675318208
Added --remove-unused-included-templates option
2019-03-04 19:10:49 +01:00
Daniel Marjamäki
c5a512338e
--check-headers=no: remove more templates in headers that are not used in the source file
2019-03-03 20:18:54 +01:00
IOBYTE
40d7d5a3d0
template simplifier: fix return type of out of line member function when it is a template parameter ( #1723 )
2019-03-03 19:42:46 +01:00
Daniel Marjamäki
41db8afe87
--check-headers=no: remove templates in headers that are not used in the source file
2019-03-03 12:56:37 +01:00
Daniel Marjamäki
eb109af00f
Replace Token::simpleMatch with Token::Match for complex pattern
2019-03-03 12:40:55 +01:00
Daniel Marjamäki
59ec5f961f
--check-headers=no: remove types in headers that are not used in the source file
2019-03-03 12:36:33 +01:00
Daniel Marjamäki
411a3f09f7
--check-headers=no: Remove unused function declarations
2019-03-03 09:18:12 +01:00
IOBYTE
b222953bae
template simplifier: only constant fold template instantiation arguments ( #1721 )
...
* template simplifier: only constant fold template instantiation arguments
* Fix travis build.
2019-03-03 07:40:55 +01:00
Daniel Marjamäki
f5c274b3b1
Added '--check-headers=no' option.
2019-03-02 19:52:15 +01:00
Daniel Marjamäki
8a3b73ffdb
Do not write extra uninitvar warnings
2019-03-02 13:17:15 +01:00
Sebastian
9a5fcddb5d
Library configuration: Enable configuring the direction of arguments. ( #1717 )
...
This enhances the library configuration so the direction of function
arguments can be specified (in, out, inout).
isVariableChangedByFunctionCall() uses this information now to avoid
guessing.
2019-03-01 15:47:08 +01:00
Daniel Marjamäki
845c407ab7
Fixed pattern matching in isVariableChanged() to handle normal token list better
2019-03-01 13:23:03 +01:00
IOBYTE
b78b3c6ab1
Fixed #9005 (Syntax error on valid C++) ( #1716 )
2019-03-01 08:18:53 +01:00
PKEuS
8af3708aa3
Optimization: Library does not need to store "#define " substring for each define
2019-02-28 22:34:26 +01:00
Daniel Marjamäki
5563fef7bb
Fixed #9008 (new crash in clang test suite)
2019-02-28 20:34:07 +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
Daniel Marjamäki
494dd2ba3a
Revert "Improved isVariableChangedByFunctionCall, better logic when parameter might be passed by reference"
...
This reverts commit 14a0031e88
.
2019-02-28 15:56:25 +01:00
Daniel Marjamäki
14a0031e88
Improved isVariableChangedByFunctionCall, better logic when parameter might be passed by reference
2019-02-28 10:26:47 +01:00
Daniel Marjamäki
857681a049
Make quick fix for uninitialized variable false positive. Will look more at this soon.
2019-02-28 09:52:52 +01:00
IOBYTE
98bf112352
template simplifier: fix recursive variable templates ( #1711 )
2019-02-28 08:30:04 +01:00
Sebastian
c8a7a4c653
library.cpp: WarnInfo: Fix crash ( #1697 )
...
If no 'alternatives' argument was specified and the `<warn/>` element
did not contain any text Cppcheck crashed because of a null pointer
access.
If there is no 'reason' and no 'alternatives argument and also no text loadFunction() returns with an error.
2019-02-28 06:19:42 +01:00
PKEuS
11daabc1a8
Set version to 1.87.99/1.88 dev
2019-02-27 21:30:54 +01:00
Daniel Marjamäki
e27a7a585f
Fix uninitvar false positive when taking address of variable
2019-02-27 18:44:30 +01:00
Daniel Marjamäki
80143725dd
Fixed #8999 (False positive uninitvar related to casting)
2019-02-27 17:58:25 +01:00
Daniel Marjamäki
226f0c7544
Fixed ValueType for auto variable
2019-02-27 10:28:18 +01:00
Paul Fultz II
032020c40d
Fix issue 9001: FP: Found suspicious operator ',' [constStatement]
2019-02-27 07:09:22 +01:00
Paul Fultz II
e846312fed
Check subtraction of pointers to different objects
2019-02-27 06:55:48 +01:00
rikardfalkeborn
0e988cc755
Fix #8992 : Add originalTypeToken to auto ( #1701 )
2019-02-27 06:44:31 +01:00
rikardfalkeborn
c9efc26578
valueflow: Mark getLifetimeToken() static ( #1703 )
...
Fixes a compiler warning about missing declaration.
2019-02-26 23:35:11 +01:00
Daniel Marjamäki
c44e2ed378
sizeof: write inconclusive warning if calculation in sizeof is done indirectly by macro
2019-02-26 21:06:44 +01:00
Daniel Marjamäki
9e93e89a4d
UninitVar: Fix false positives when there is possible cast
2019-02-26 19:26:46 +01:00
IOBYTE
bf85767829
template simplifier: make sure all instantiations are found and expan… ( #1696 )
...
* template simplifier: make sure all instantiations are found and expanded in #5097
* template simplifier: check output on another test
* template simplifier: add output to another test
2019-02-26 06:41:04 +01:00
IOBYTE
3f257d6310
template simplifier: instantiate template class when something inside… ( #1695 )
...
* template simplifier: instantiate template class when something inside class instantiated.
* template simplifier: add output to another test that now works
2019-02-25 21:01:34 +01:00
Daniel Marjamäki
ef6fc67da4
Move CheckString::checkAlwaysTrueOrFalseStringCompare() from runSimplifiedChecks() to runChecks()
2019-02-25 18:11:33 +01:00
Daniel Marjamäki
f1146e398a
Moved CheckString::sprintfOverlappingData from runSimplifiedChecks to runChecks
2019-02-25 09:23:03 +01:00
Daniel Marjamäki
4218698fb1
Moved CheckString::checkIncorrectStringCompare from runSimplifiedChecks to runChecks
2019-02-25 09:08:16 +01:00
Daniel Marjamäki
d84d8885f7
SymbolDatabase: Fix TODO assertions
2019-02-24 19:11:18 +01:00
Daniel Marjamäki
ef731064bd
Fixed #8964 (ValueType: auto constness)
2019-02-24 08:16:08 +01:00
Daniel Marjamäki
c855cf8682
ValueType: Better constness for auto variable
2019-02-23 18:16:18 +01:00
Daniel Marjamäki
b43572d75e
Fixed #8969 (C++ functional cast not handled correctly)
2019-02-23 17:29:53 +01:00
Daniel Marjamäki
68062e3702
Fixed #8954 (false positive: Local variable x shadows outer variable)
2019-02-23 16:22:22 +01:00
Paul Fultz II
fd3c1fd040
Fix issue 1777: Undefined Behavior: Comparing pointers to different objects
...
This uses the lifetime analysis to check when comparing pointer that point to different objects:
```cpp
int main(void)
{
int foo[10];
int bar[10];
int diff;
if(foo > bar) // Undefined Behavior
{
diff = 1;
}
return 0;
}
```
2019-02-23 08:32:08 +01:00
ivangalkin
1b703ce58e
7772 Add uninitMemberVarPrivate to errorlist (really) #1557 ( #1686 )
...
Previous attempt 70527a78f7
doesn't work because equal error messages are filtered.
2019-02-23 08:07:46 +01:00
Paul Fultz II
941dd79f0d
Fix FP issue 8986: constArgument check warns for elements of const array ( #1683 )
2019-02-22 06:39:59 +01:00
Paul Fultz II
507c7a4388
Improvement to lifetime tracking of addressof and derefencing
...
This will now warn for cases like this:
```cpp
auto& f() {
std::vector<int> x;
return x[0];
}
```
It also improves the handling of address of operator, so it can now warn across some function calls, like this:
```cpp
int& f(int& a) {
return a;
}
int* hello() {
int x = 0;
return &f(x);
}
```
2019-02-22 06:38:56 +01:00