Daniel Marjamäki
0014fe880e
Mark members and arguments with 'nonneg'
2019-07-14 12:22:33 +02:00
Daniel Marjamäki
f5e76a2d18
Avoid 'unsigned' when declaring int variables in checkuninitvar
2019-07-13 15:31:17 +02:00
Daniel Marjamäki
95d65c8c34
Refactoring; enum class
2019-07-10 14:05:16 +02:00
Daniel Marjamäki
7ca35d181b
uninitStructMember: Fixed FP shown in daca@home
2019-06-02 20:19:53 +02:00
Daniel Marjamäki
15fc9a622d
CheckBufferOverrun: Add CTU analysis
2019-03-23 08:36:10 +01:00
Daniel Marjamäki
b9ac77a31b
Uninitialized variables: Fixed false positive
2019-03-09 11:30:45 +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
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
8a3b73ffdb
Do not write extra uninitvar warnings
2019-03-02 13:17:15 +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
9e93e89a4d
UninitVar: Fix false positives when there is possible cast
2019-02-26 19:26:46 +01:00
Daniel Marjamäki
6ca1aba4a7
UninitVar: Fix --experimental-fast issues
2019-02-10 19:00:01 +01:00
Daniel Marjamäki
bd7790fd8c
Update copyright year
2019-02-09 07:24:06 +01:00
Daniel Marjamäki
c75a2265c0
Fix inline suppression.
2019-01-13 12:10:26 +01:00
Daniel Marjamäki
a520a41e64
CheckUninitVar: Try to report all CTU issues not just the first found issue
2018-12-31 07:54:00 +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
378e083585
CTU: Refactoring the xml load/write. Renamed members.
2018-12-30 11:55:39 +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
a788512d66
CTU: Refactor isUnsafeFunction
2018-12-26 19:17:49 +01:00
Daniel Marjamäki
a6e227a73c
CTU: Refactoring; getErrorPath
2018-12-26 15:56:10 +01:00
Daniel Marjamäki
e39be48c92
CTU: Refactoring, create ErrorPath in ctu
2018-12-26 11:36:26 +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
c7993df4ff
Refactoring; Use range for loops
2018-12-25 11:47:45 +01:00
Daniel Marjamäki
0f63874c62
Take back the whole program analysis for null pointers and uninitialized variables
2018-12-18 07:56:33 +01:00
Paul Fultz II
54453c5802
Fix FP when copying pointer to string ( #1479 )
2018-11-14 06:59:25 +01:00
Daniel Marjamäki
be1ff268c0
Refactoring: Use range for loops
2018-10-24 11:29:15 +02:00
Simon Martin
915acac0b8
Ticket #8734 : Skip static member variables in CheckUninitVar. ( #1388 )
2018-09-22 16:52:34 +02:00
Daniel Marjamäki
fc97a5b11c
Uninitalized variables: Fixed false positive
2018-08-15 18:04:36 +02:00
Daniel Marjamäki
79ffe1d4fc
Rename _tokenizer, _settings, _errorLogger
2018-06-16 16:10:28 +02:00
PKEuS
0090ae5cf2
Optimization in CheckUninitVar::checkStruct(): Replaced expensive inner loop on all scopes by loop on child scopes for faster lookup for inner unions.
...
This speeds up checking of very large code files; for example, it reduces checking time for SQLite amalgamation by more than 20%
2018-05-14 15:48:57 +02:00
Daniel Marjamäki
f336c2efe7
Refactoring; Renamed Scope::classStart and Scope::classEnd
2018-04-27 22:36:30 +02:00
Daniel Marjamäki
fba8208134
CheckUninitVar: Use isLikelyStreamRead
2018-04-22 17:04:54 +02:00
Daniel Marjamäki
cc4977e140
Tweaking CheckUninitVar (<< and >> handling)
2018-04-22 16:39:57 +02:00
Daniel Marjamäki
4f6bd5d607
Fix Travis
2018-04-17 14:54:12 +02:00
Daniel Marjamäki
c84628c28a
Fixed #8494 (False positive: serialization class overloads operator)
2018-04-17 14:23:04 +02:00
Daniel Marjamäki
a0906140a6
Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName.
2018-04-09 06:43:48 +02:00
jrp2014
d2160f00b2
Refactor lib/checkuninitvar.cpp
2018-04-06 08:04:06 +02:00
jrp2014
b6504c70ca
Improve constness
2018-04-04 21:51:31 +02:00
Daniel Marjamäki
58066b1f0c
Remove whole program analysis from 'uninitialized variables' and 'null pointer dereference' checkers. I think this logic can more or less be added in ValueFlow instead and then all ValueFlow checkers should get whole program analysis.
2018-02-06 14:56:17 +01:00
Daniel Marjamäki
71511f3131
Refactor f487182
2018-02-06 08:59:36 +01:00
Ivan Maidanski
f487182075
Suppressed unused functions should not lead to nonzero exit code ( #1026 ) ( #1078 )
...
This is a fix of commit 97ffec8
.
2018-02-06 07:44:53 +01:00
Daniel Marjamäki
dbc6771a0b
Uninitialized variables: Fix FP for unknown macro like 'list_for_each'
2018-02-04 22:30:08 +01:00
Daniel Marjamäki
4998248501
Null pointers: Fixed false positives when running whole program analysis. Copied the fix from the CheckUninitVar::isUnsafeFunction.
2018-02-04 15:29:57 +01:00
Daniel Marjamäki
d47b7726fa
Uninitialized variables: Fix potential false positives in subfunction if there is early return or conditional writes
2018-02-04 09:40:57 +01:00
Daniel Marjamäki
1fe59faecb
changed message ids for uninitvar/nullpointer errors that was found by whole program analysis
2018-02-03 16:05:07 +01:00
Daniel Marjamäki
f5a11a6510
UninitVar: Speedup whole program analysis a bit
2018-01-29 15:15:35 +01:00
Daniel Marjamäki
9109956c8c
UninitVar: Improve whole program analysis, used isVariableUsage()
2018-01-25 21:49:21 +01:00
Daniel Marjamäki
51c2ded23f
Fix crash
2018-01-25 19:42:50 +01:00
Daniel Marjamäki
4d66609173
Fix Cppcheck warning, uninitialized member variable
2018-01-25 17:29:08 +01:00
Daniel Marjamäki
f73da16e94
Revert "UninitVar: Better checking in whole program analysis"
...
This reverts commit b2bdc2687b
.
2018-01-25 17:05:57 +01:00
Daniel Marjamäki
b2bdc2687b
UninitVar: Better checking in whole program analysis
2018-01-25 15:56:46 +01:00
Daniel Marjamäki
ce60b326f4
Whole program analysis: Improved handling of nested calls
2018-01-24 22:53:14 +01:00
Daniel Marjamäki
512b9f512c
Refactoring whole program analysis for CheckUninitVar and CheckNullPointer
2018-01-21 22:56:46 +01:00
Daniel Marjamäki
351b382a7b
Null pointers: Whole program analysis
2018-01-21 19:51:15 +01:00
Daniel Marjamäki
ea63e52d98
UninitVar: Improved function/method matching in whole program analysis
2018-01-21 10:40:35 +01:00
Daniel Marjamäki
c331a10fa7
Refactorings, and try to ensure that analyzer info is stored/loaded properly
2018-01-15 19:12:31 +01:00
Daniel Marjamäki
f2b2e87fb6
Uninitialized Variables: some additional tweaks. Try to fix Travis
2018-01-15 17:35:21 +01:00
Daniel Marjamäki
100887429d
Uninitialized variables: Whole program analysis for function calls
2018-01-15 15:54:09 +01:00
Daniel Marjamäki
c4caee6b18
Updated copyright year
2018-01-14 15:37:52 +01:00
Daniel Marjamäki
255b788d4d
Fixed #4903 (Improve check: allocated but not initialized (condition))
2018-01-02 23:20:46 +01:00
Daniel Marjamäki
ba8222de1c
ValueFlow: Put 'inconclusive' state in the ValueKind. A value can't be both known and inconclusive.
2017-09-20 22:41:36 +02:00
Daniel Marjamäki
57004ed533
Fixed #7663 (False positive: uninitialized variable (multi variables in inner scopes))
2017-09-07 23:08:55 +02:00
Daniel Marjamäki
d160d27417
Fixed #8172 (False positive uninitvar on sizeof *ptr)
2017-08-23 22:17:49 +02:00
Daniel Marjamäki
e087156e30
CheckUninitVar: Try to activate the valueflow based checking again
2017-08-20 19:54:06 +02:00
Daniel Marjamäki
22919da9a8
Fixed #6246 (Defect: False positive due to ignoring struct initialisation when nested in a loop and assigned to a member)
2017-06-30 13:41:19 +02:00
Daniel Marjamäki
3ab8466415
refactoring, use early continue in for loop
2017-06-30 12:45:48 +02:00
Ayaz Salikhov
3cd2f2d092
Don't cast bool to bool
2017-06-01 01:49:40 +03:00
Ayaz Salikhov
28aa939d69
iwyu - include what you use
2017-05-27 04:33:47 +02:00
Daniel Marjamäki
95db173e77
Fixed Cppcheck warning
2017-05-13 11:06:33 +02:00
Daniel Marjamäki
f51a709f80
add fixme comment
2017-05-01 11:25:58 +02:00
Daniel Marjamäki
ce6cc5416a
uninitvar: made ValueFlow check experimental
2017-05-01 11:13:30 +02:00
Daniel Marjamäki
06102cb3d7
UninitVar: Don't warn for inconclusive values
2017-04-28 21:09:56 +02:00
Daniel Marjamäki
2f51b975ed
valueFlowUninit: only check variables
2017-04-23 21:50:51 +02:00
Daniel Marjamäki
25a1ea3d18
use simpleMatch for simple pattern
2017-04-23 19:25:35 +02:00
Daniel Marjamäki
8a738eefab
fixed #7998 (uninitialized variable is not found when used with switch/case)
2017-04-23 18:05:14 +02:00
Daniel Marjamäki
43454936e7
Fixed #8014 (FP: Uninitialized variable 'f(1,{..});')
2017-04-21 22:33:27 +02:00
PKEuS
3c8f5b85ae
Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10%
2017-03-27 18:48:34 +02:00
PKEuS
2f0db369f0
Refactorization: Avoid construction of empty strings by using emptyString
2017-03-01 10:50:50 +01:00
Matthias Krüger
6f1e7e897d
simplify if(tok && Token::{simple,}Match) to if(Token::{simple,}Match).
2017-02-06 15:37:12 +01:00
Daniel Marjamäki
c8a450c9be
uninitvar: Fixed a FP seen in daca2
2016-12-25 22:43:29 +01:00
Daniel Marjamäki
d79688c40b
Fixed #7822 (False positive for uninitialized variable if array type is used)
2016-12-21 23:11:11 +01:00
PKEuS
2f6350a0d0
Refactorized Library
2016-12-06 14:09:28 +01:00
Matthias Krüger
b3ace258ab
there is no need to have "if(tok && Token::Match(tok,..." since Token::Match checks "tok" by itselfs already.
2016-11-26 17:22:30 +01:00
orbitcowboy
a81920cae1
checkunusedvar: Check pointer against NULL before dereferencing it.
2016-10-31 15:57:34 +01:00
orbitcowboy
bc32ccc894
CheckUninitVar::isFunctionParUsage: Avoid implicit conversion from type bool to int.
2016-10-29 21:41:55 +02:00
PKEuS
e1a21a8bb1
Fixed internal warnings
2016-10-08 11:34:25 +02:00
Harald Scheidl
9f1b70fa04
new can initialize memory, don't warn in this case ( #7623 )
2016-10-08 10:03:09 +02:00
Daniel Marjamäki
9711064b74
Fixed #6646 (False positive uninitvar - loopvariable initialized inside loop)
2016-08-04 14:39:54 +02:00
Robert Reif
55b3f0bf38
Fixed #752 (SymbolDatabase: Does not match function if redundant keywords mismatch (C++))
2016-08-04 09:06:32 +02:00
Daniel Marjamäki
2187e8ba02
CheckUninitVar: Fixed FP when dereferencing multidimensional arrays. Refactoring of testing. The FP was spotted when looking at #7092
2016-08-02 14:27:51 +02:00
Daniel Marjamäki
dc2a92263a
Fixed #7426 (RFC: time to replace simplifyEnum?)
2016-04-22 06:02:54 +02:00
Daniel Marjamäki
34b5e0ce99
Fixed #6873 (False positive uninitvar - variable initialized via pointer)
2016-02-07 18:48:57 +01:00
Alexander Mai
d3546ea410
#7321 segmentation fault in valueFlowSwitchVariableScope::isVariableDeclaration
2016-02-03 22:49:57 +01:00
Roberto Martelloni
50fc784550
Mapped error ids stlBoundaries, stlcstr, useAutoPointerContainer, useAutoPointerArray, sprintfOverlappingData, strPlusChar, shiftTooManyBits, integerOverflow, uninitstring, uninitdata, uninitvar, uninitStructMember, deadpointer, va_start_referencePassed, va_end_missing, va_list_usedBeforeStarted, va_start_subsequentCalls to their CWEs.
2016-02-03 12:53:23 +00:00
Daniel Marjamäki
b908bb18a9
Fixed #5503 (FP: Uninitialized variable - initialize in in if and else branch)
2016-01-30 20:48:28 +01:00
Lauri Nurmi
996c9244d8
Update copyright year to 2007-2016.
2016-01-01 15:34:45 +02:00
Alexander Mai
f762affea0
Small refactoring: replace NULL by nullptr, remove redundant static keyword, Tokenizer::setVarId() uses const variable 'notstart'
2015-11-30 22:13:49 +01:00
PKEuS
e8522c7883
Small refactorizations:
...
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
Daniel Marjamäki
d93cf96a29
Fixed #6769 (false positive: Uninitialized struct member: epoch.integer)
2015-11-22 16:20:46 +01:00
Daniel Marjamäki
5f68f3ddf6
Fixed #6264 (FP: gimp: struct initialized via pointers to member variables)
2015-11-21 19:31:18 +01:00
Daniel Marjamäki
fb0477affd
CheckUninitVar: Fixed false negatives when there are conditions
2015-11-21 10:00:21 +01:00
Daniel Marjamäki
d301cf28ec
CheckUninitVar: Small logical fixes in conditions handling.
2015-11-21 08:32:25 +01:00
Daniel Marjamäki
4d3e231bd0
Fixed #3948 (False positive: variable not initialised - used in multi-condition if-clause)
2015-11-19 13:09:45 +01:00
Daniel Marjamäki
0f9d90d2be
Changed Copyrights. Removed my name.
2015-11-18 20:04:50 +01:00
Daniel Marjamäki
5772bbd206
Fix Cppcheck warning 'explicit constructor'
2015-11-18 15:56:48 +01:00
Daniel Marjamäki
6b9c12e806
CheckUninitVar: Refactoring and gcc-compatibility fix
2015-11-18 15:16:50 +01:00
Daniel Marjamäki
e6ceae213e
CheckUninitVar: Improving multi-variable value handling
2015-11-18 14:56:45 +01:00
Daniel Marjamäki
459a4e0cbe
Fixed #7121 (False positive 'Uninitialized variable' converting pointer to reference)
2015-11-10 10:18:24 +01:00
PKEuS
963008089d
Fixed false positive with range-based for-loop ( #7078 )
2015-10-28 16:37:46 +01:00
Daniel Marjamäki
bfd8a69e74
Fixed #6243 (False positive: uninitialized variable, looping with goto)
2015-10-27 12:40:52 +01:00
PKEuS
e989d4b11b
Support C++11 array initialization in CheckUninitVar ( #7010 )
2015-10-24 12:06:40 +02:00
Daniel Marjamäki
305760f143
Uninitialized variables: Fix FP for struct array
2015-09-16 14:42:55 +02:00
Daniel Marjamäki
af233efcce
Uninitialized variables: tweaked checking of arrays / allocated buffers
2015-09-14 09:03:21 +02:00
Matthias Krüger
2ddd4c7197
fix [lib/checkuninitvar.cpp:836]: (warning) Found simple pattern inside Token::Match() call: "&"
2015-09-13 17:54:53 +02:00
Daniel Marjamäki
ab38ab800e
CheckUninitVar: don't rely on Tokenizer::simplifyKnownVar() to simplify references
2015-09-13 17:31:45 +02:00
Daniel Marjamäki
ad007ca2d7
Uninitialized variables: better checking of arrays
2015-09-13 16:32:16 +02:00
Daniel Marjamäki
6ddd0a953f
Fixed #6917 (False positive uninitvar - unused array declaration and ternary expression)
2015-08-29 13:19:28 +02:00
Simon Martin
6fb19b02d0
Properly differentiate arrays of pointers and pointers to arrays.
2015-08-25 21:19:19 +02:00
PKEuS
ab8afec3eb
Refactorizations:
...
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
Daniel Marjamäki
7ede9de502
Removed unused code. The isVariableUsed is used instead.
2015-08-15 07:43:39 +02:00
Daniel Marjamäki
e71ab70356
Fixed #6871 (False positive uninitvar - pointer to uninitialized char[])
2015-08-08 14:52:46 +02:00
Daniel Marjamäki
7ec8adeb93
Fixed #6701 (Uninitialized variable warning when header could not be found)
2015-08-08 08:53:08 +02:00
Daniel Marjamäki
4bebb80300
Fixed #6869 (False positive: uninitvar, array passed to function)
2015-08-05 10:19:17 +02:00
Daniel Marjamäki
e598b07a6d
Moved functions to astutils
2015-08-03 09:20:50 +02:00
Daniel Marjamäki
acc1566f64
uninitvar: Improved condition handling. Fixes one problem when running 'tools/run_more_tests.sh test/testuninitvar.cpp'
2015-07-25 17:55:01 +02:00
Daniel Marjamäki
234669b02b
Removed the UninitVar::analyseFunctions(). This was written for multifile checking however it did not work as it should => no multifile errors can be detected.
2015-07-24 08:30:38 +02:00
Daniel Marjamäki
ea933e9873
CheckUninitVar: Removed ExecutionPath based checker
2015-07-23 17:28:18 +02:00
Daniel Marjamäki
0b81a267f4
uninitvar: handling arrays in non-executionpath checker
2015-07-23 14:51:38 +02:00
Daniel Marjamäki
8d8c03dad8
uninitvar: removed returns from new checking to fix 'more' tests. these returns should be readded when the executionpath checking is removed.
2015-07-23 09:21:53 +02:00
Daniel Marjamäki
79067ac031
uninitvar: use new checking instead of executionpath in more tests. small improvements in new checking to fix testcases.
2015-07-23 08:46:59 +02:00
Daniel Marjamäki
1de1aaa2f4
CheckUninitVar: Fix crash when AST is not created properly
2015-07-22 22:17:12 +02:00
Daniel Marjamäki
1f5eea98b5
CheckUninitVar: Fix a FP reported for invalid code
2015-07-22 21:58:06 +02:00
Daniel Marjamäki
42ed436e9d
Tweaks in uninitvar, small steps to make it possible to remove the ExecutionPath
2015-07-22 20:31:58 +02:00
PKEuS
bdd53b4142
Fixed false positive #6717
2015-07-21 12:13:59 +02:00
amai2012
1604e751e5
Fix some compiler warnings which got introduced recently
2015-06-30 20:11:51 +02:00
amai2012
4a47b8b3ae
Refactoring: Better distinguish between C and C++ in a few checks.
2015-06-28 16:49:16 +02:00
Martin Ettl
272cf27ec3
Improved constness of local variable, no functional changes.
2015-06-20 11:33:27 +02:00
Daniel Marjamäki
02df692b0b
Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member))
2015-06-19 18:21:46 +02:00
Alexander Mai
13c1c2c035
Refactoring (use const std::set for strings). Omit some matching for C++ stuff within C code.
2015-06-17 22:28:15 +02:00
PKEuS
3ce4e68ca6
Refactorization: Make use of do-loops to avoid redundant Token::Match() calls
2015-05-13 13:40:40 +02:00
Simon Martin
da302b3912
Ticket #6680 : Members can be initialized by operator>>.
2015-05-10 14:27:15 +02:00
amai2012
8d8fffb20f
#6651 Don't call member function on NULL pointer - even if call is "safe"
2015-04-17 08:47:59 +02:00
Matthias Krüger
42f0955e3f
Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
...
Follow up to eedcb6abcb
.
2015-04-10 14:31:19 +02:00
Daniel Marjamäki
d563bd73f4
Fixed #6583 (False positive uninitvar - exit() ignored?!)
2015-04-08 15:35:04 +02:00
Dmitry-Me
5f6aaa4573
Make the check slightly less convoluted
2015-03-20 11:03:11 +03:00
Daniel Marjamäki
42c4aa1c49
Fixed #4880 (false negative: uninitialized variable, handling of conditional noreturn scopes)
2015-03-14 17:59:11 +01:00
Dmitry-Me
89ec9058a8
Proper if-else-if chain for mutually exclusive conditions
2015-03-14 15:09:46 +03:00