Commit Graph

1344 Commits

Author SHA1 Message Date
Oliver Stöneberg efaaa58896
fixed some `modernize-use-emplace` false negatives and some `bugprone-assignment-in-if-condition` warnings () 2022-07-28 22:53:59 +02:00
Oliver Stöneberg b65b47d3a8
enabled and fixed `modernize-pass-by-value` clang-tidy warnings () 2022-07-28 22:51:45 +02:00
chrchr-github c340b6ae6c
Fix FP moduloofone with pow() () 2022-07-28 22:11:23 +02:00
Oliver Stöneberg 0005be1dbf
some cleanups () 2022-07-26 08:28:55 +02:00
Oliver Stöneberg b2f15fdbb1
reduced padding in some classes/structs () 2022-07-24 10:17:11 +02:00
chrchr-github 5342e2cd03
Fix FP knownConditionTrueFalse with dynamic_cast () 2022-07-20 20:48:17 +02:00
Oliver Stöneberg 4316884123
valueflow.cpp: avoid some copies related to `ErrorPath` () 2022-07-20 10:57:49 +02:00
chrchr-github 9e74da6126
Fix FP compare with negated constant () 2022-07-16 07:28:15 +02:00
Armin Müller 0ae9877766
Typos found by running "codespell" () 2022-07-10 22:40:05 +02:00
chrchr-github f5c4a21eae
Fix FN redundantCopyLocalConst () 2022-07-10 11:33:24 +02:00
Paul Fultz II edebe746bc
Fix 10361: false negative: uninitvar (std::next(iterator)) () 2022-07-09 07:39:04 +02:00
Paul Fultz II 0b63e7273d
Fix 11162: FP: knownConditionTrueFalse ()
* Fix 11162: FP: knownConditionTrueFalse

* Format
2022-07-09 00:57:25 +02:00
Daniel Marjamäki 29402b4d1a Fix Coverity CID1490221 warning. settings is dereferenced and then checked. 2022-07-05 07:46:39 +02:00
Paul Fultz II e735376f7d
Refactor to use AST for isContainerSizeChanged () 2022-06-19 08:17:05 +02:00
Paul Fultz II e6fdcb9de2
Refactor to use derefShared () 2022-06-19 08:16:27 +02:00
Paul Fultz II 3e09503561
Fix 11087: false negative: usage of reference to member of temporary object not detected ()
* Fix 11087: false negative: usage of reference to member of temporary object not detected

* Format

* Add another test case

* Fix FP with pointer

* Format
2022-06-16 19:26:36 +02:00
Paul Fultz II 9cecc8468e
Fix 10570: Improve check; condition then pointer dereference, different pointers ()
* Try to use after assign in loop

* Update valueflow forward to handle init tokens

* Fix tests

* Make test TODO

* Format

* Add tests

* Format

* Fix ubsan error

* Use simpleMatch
2022-06-16 19:26:23 +02:00
Paul Fultz II de51ebbcf4
Fix 9135: Access of moved variable not detected in loop ()
* Fix 9135: Access of moved variable not detected in loop

* Format

* Fix issue with pushing back on container

* Format

* Fix null pointer

* Remove yeild for now
2022-06-16 17:40:09 +02:00
Paul Fultz II d4fb5652c0
Fix 10619: Valueflow: Library function in subfunction does not propagate all values () 2022-06-12 07:17:28 +02:00
Paul Fultz II cee48e5e19
Add backtrace to valueflow in debug mode () 2022-06-12 07:13:42 +02:00
Paul Fultz II 653a1ea83e
Fix 11100: FP knownConditionTrueFalse with getter/setter member functions ()
* Fix 11100: FP knownConditionTrueFalse with getter/setter member functions

* Format
2022-06-11 11:00:40 +02:00
PKEuS 99ce89c003
Improvement: Set varId for variables with global scope operator :: Refactorization: Moved internal class from tokenize.h to tokenize.cpp ()
Merged from LCppC.
2022-06-11 08:11:16 +02:00
Paul Fultz II c9b85010f9
Fix 11096: FP knownConditionTrueFalse in do while loop ()
* Check for loop

* Improve handling of exit values

* Add more checks to test

* Simplify

* Remove unnecessary test

* Fix typo

* Format

* Use simpleMatch
2022-06-10 20:42:02 +02:00
PKEuS 1275b5275e
LCppC backport: Various optimizations ()
* Optimization: Use Token::eIncDecOp instead of expensive Token::Match calls

Merged from LCppC.

* Small Optimizations: - Moved a std::set that is only need during initialization of SymbolDatabase to function scope - Use std::vector instead of std::list

Merged from LCppC.

* Optimization: Refactorized various Token::Match calls and surrounding conditions

Merged from LCppC.

* Refactorization: Cleanup usage of std::multimap

Merged from LCppC.
2022-06-08 16:58:57 +02:00
Oliver Stöneberg ce945ec7fc
enabled and fixed `modernize-use-override` clang-tidy warnings () 2022-06-03 21:32:39 +02:00
Paul Fultz II 72342de0da
Fix 11114: FP knownConditionTrueFalse across functions ()
* Fix 11114: FP knownConditionTrueFalse across functions

* Format
2022-06-02 23:24:11 +02:00
Paul Fultz II e430a11b49
Add debug_valueflow instrinsic to show valueflow values and its error path ()
* Add debug_valueflow instrinsic to show valueflow values and its error path

* Format
2022-06-01 06:53:21 +02:00
Paul Fultz II d7c914bd3e
Handle subfunction values in valueflow conditions () 2022-05-29 19:57:10 +02:00
Paul Fultz II 7405ea039d
Refactor valueflow forward and reverse functions and unify them ()
* Move functions around

* Make it a template to handle both overloads

* Simplify forward

* Remove container forward

* Remove unused settings params

* Format

* Remove valueFlowForwardExpression

* Format

* Remove init list

* Make const ref

* Remove braces

* Remove braces
2022-05-24 06:41:17 +02:00
Paul Fultz II 5999b35130
Fix 10944: FN: knownConditionTrueFalse ()
* Fix 10944: FN: knownConditionTrueFalse

* Use or

* Format
2022-05-23 23:22:08 +02:00
Paul Fultz II 90e6c10c12
Fix 11072: FP arrayIndexOutOfBounds, nullPointer with nested loops ()
* Fix 11072: FP arrayIndexOutOfBounds, nullPointer with nested loops

* Format

* Remove print statement
2022-05-18 08:29:30 +02:00
Oliver Stöneberg 14421ae627
fail `run-clang-tidy` in case of compiler warnings / fixed Clang warnings / cleanups () 2022-05-15 12:42:29 +02:00
Paul Fultz II fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member ()
* Fix 11057: FP danglingTemporaryLifetime with reference member

* Add test

* Format

* Use ast for number of arguments

* Get number of arguments using ast

* Skip aggregate constructor when there are too many arguments

* Format
2022-05-13 06:51:07 +02:00
Oliver Stöneberg c71033548f
fixed some clang-tidy warnings () 2022-05-08 20:42:06 +02:00
Paul Fultz II 843f7893d6
Fix 11040: FP nullPointer after loop () 2022-05-05 06:55:02 +02:00
Paul Fultz II 5afd6880c3
Fix 11028: False positive: invalidContainer ()
* Fix 11028: False positive: invalidContainer

* Format
2022-05-05 06:54:36 +02:00
Paul Fultz II 496b45f27b
Fix 11009: FP uninitvar ()
* Fix 11009: FP uninitvar

* Format
2022-05-04 05:59:01 +02:00
Paul Fultz II 3edb10a006
Fix 11024: FP returnDanglingLifetime with c_str() passed to constructor () 2022-05-03 11:42:32 +02:00
Paul Fultz II 3e686103ae
Fix 10984: False positive: invalidContainer when explictly capturing vector by reference () 2022-04-30 09:36:28 +02:00
Paul Fultz II 4e7125554f
Fix 8358: FP: Condition '(number*0)!=0' is always false () 2022-04-30 09:35:51 +02:00
Paul Fultz II 9fa5c4e201
Fix 11011: FP returnDanglingLifetime with non-const reference argument [inconclusive] ()
* Fix 11011: FP returnDanglingLifetime with non-const reference argument [inconclusive]

* Format
2022-04-30 08:23:58 +02:00
Paul Fultz II aafd1e10be
Fix 11006: FP uninitvar with unknown constant () 2022-04-28 10:48:37 +02:00
chrchr-github bcbc29affb
Fix FP: negativeIndex if function call is made after index check ()
* Fix  FP: negativeIndex if function call is made after index check

* Improve container check

* Format
2022-04-27 14:08:44 +02:00
Paul Fultz II 474c7fe5cc
Fix 10953: False positive: Possible null pointer dereference when calling derived function () 2022-04-26 17:57:06 +02:00
Paul Fultz II 5d5562266d
ValueFlow: Assume constant is nonzero when its negated ()
* ValueFlow: Assume constant is nonzero when its negated

* Format

* Format
2022-04-23 06:19:07 +02:00
chrchr-github 6e69b751eb
Fix Match pattern () 2022-04-15 08:48:49 +02:00
Paul Fultz II 28cf14f110
Fix 10975: false negative: dangling reference in class ()
* Fix 10975: false negative: dangling reference in class

* Format
2022-04-14 18:59:12 +02:00
chrchr-github 6450d5701c
Fix FP arrayIndexOutOfBoundsCond with sizeof ()
* Fix  FP constVariable with pointer typedef

* Fix flag check

* Use isStatic()

* Fix  FP arrayIndexOutOfBoundsCond with sizeof and extra parentheses
2022-04-14 18:13:29 +02:00
Paul Fultz II 6deb8068fa
Fix 10981: ValueFlow: multiplication with 0 should have known value 0 () 2022-04-14 18:13:04 +02:00
Paul Fultz II 09597bc7e8
Fix 10956: ValueFlow: Incorrect value when assigned to two variables ()
* Fix 10956: ValueFlow: Incorrect value when assigned to two variables

* Format
2022-04-14 07:35:07 +02:00
Oliver Stöneberg 45158ec064
cleaned up includes based on include-what-you-use ()
* cleaned up includes based on include-what-you-use

* updated translations
2022-04-13 12:24:00 +02:00
Paul Fultz II 6c82fb05a4
Fix 10954: False positive: returnDanglingLifetime when using c_str() () 2022-04-12 08:09:13 +02:00
Paul Fultz II 61b87bcc60
Fix 10955: False positive: containerOutOfBounds when using a const reference member () 2022-04-12 08:07:55 +02:00
Paul Fultz II d97942d3c6
Fix 6577: Detect pointer to uninitialised memory with clock_settime() ()
* Fix 6577: Detect pointer to uninitialised memory with clock_settime()

* Format
2022-04-11 07:23:44 +02:00
Paul Fultz II 45b4580554
Fix 10957: Crash on valid code () 2022-04-10 22:47:58 +02:00
Oliver Stöneberg 25ef9eeb26
use std::string::empty() () 2022-04-09 19:02:37 +02:00
Paul Fultz II 4c1aeb0cb1
Remove old pointer alias check () 2022-04-07 11:36:15 +02:00
chrchr-github 52b4aeb279
Fix FP knownConditionTrueFalse with double to int cast () 2022-04-07 10:42:57 +02:00
Paul Fultz II dad10f2ab7
Fix 7684: ValueFlow: function call 'X::GetSize()' ()
* Improve getting function to calculate the return

* Add test

* Format

* Move to cpp to avoid FP

* Format
2022-04-07 06:49:25 +02:00
Paul Fultz II 74667d1e2a
Fix 10418: false negative: knownConditionTrueFalse ()
* Improve handling inverted condition

* Fix tests

* Rename variables for clarity

* Add initial test

* Add another test

* Format

* Fix FP
2022-04-07 06:48:13 +02:00
Paul Fultz II bb640c4879
Fix 10950: Crash on function declaration ()
* Fix 10950: Crash on function declaration

* Format
2022-04-06 19:00:05 +02:00
Paul Fultz II 4fde7f8b18
Fix 10449: Regression: knownConditionTrueFalse (strlen/wcslen) ()
* Refactor library function usage

* Evaluate library function in program memory

* Fix and add tests

* Format
2022-04-06 06:35:38 +02:00
Paul Fultz II 1d92665ad2
Fix 10867: false negative: containerOutOfBounds with std::array (regression) ()
* Fix 10867: false negative: containerOutOfBounds with std::array (regression)

* Format
2022-04-06 06:25:28 +02:00
chrchr-github cfbbeb4b1b
Partial fix for FN containerOutOfBounds with std::array ()
* Partial fix for  FN containerOutOfBounds with std::array

* Format

* Format

* Optimize
2022-04-05 07:34:20 +02:00
Paul Fultz II 0547cbcd26
Fix 10647: FN knownConditionTrueFalse for impossible Boolean value ()
* Add impossible values for bool

* Fix valueflow tests

* Fix assertion failure

* Add test

* Format
2022-04-03 20:04:05 +02:00
chrchr-github 4bf8718dcb
Fix FP constStatement with pointers in lambda () 2022-04-01 19:50:40 +02:00
Paul Fultz II 32ded1602b
Fix warnings in switch statements on clang () 2022-03-30 19:30:02 +02:00
Paul Fultz II 21b8c36eb1
Fix 10916: FP: uninitvar () 2022-03-27 10:01:58 +02:00
chrchr-github 479af21405
Fix FP uninitvar with new and braced initializer () 2022-03-24 20:08:51 +01:00
Paul Fultz II 4b4037540a
valueFlowUninit: Handle arrays and pod types ()
* valueFlowUninit: Handle arrays and pod types

* Format

* Catch another array case
2022-03-24 06:35:44 +01:00
chrchr-github 3faff5e9fc
Fix FP knownConditionTrueFalse static variable with direct initialization () 2022-03-22 07:24:40 +01:00
chrchr-github 0e147502cc
Fix FN variableScope with enum and struct ()
* Fix  FN variableScope with enum and struct

* Scope reduction

* Scope reduction
2022-03-21 16:05:38 +01:00
Paul Fultz II 40ff9edad6
Fix 10843: FP: danglingTemporaryLifetime ()
* Fix 10843: FP: danglingTemporaryLifetime

* Format
2022-03-16 17:11:49 +01:00
Armin Müller 7cc45fb393
Typos found by running "codespell" ()
Co-authored-by: Armin Müller <mueller.armin@foestergroup.de>
2022-03-16 15:28:44 +01:00
Oliver Stöneberg 0d336b868c
avoid some Clang compiler warnings () 2022-03-13 20:07:58 +01:00
Oliver Stöneberg 757287b13c
removed unnecessary varid0 inline suppressions () 2022-03-12 18:02:40 +01:00
Paul Fultz II ff902369e0
Fix 10851: False positive: known variable value below for loop ()
* Fix 10851: False positive: known variable value below for loop

* Format

* Add test for 10863

* Format
2022-03-12 06:15:35 +01:00
chrchr-github fbdfb60809
Warn about buffer overruns when allocating memory with new ()
* Warn about buffer overruns when allocating memory with new

* Format

* Avoid FP
2022-03-07 19:43:40 +01:00
chrchr-github 7f682d544e
Partial fix for FN buffer access out of bounds: std::vector ()
* Fix  FN: stlOutOfBounds (off by one)

* Format

* Simplify

* Partial fix for  FN buffer access out of bounds: std::vector

* Undo

* Format

* Fix test case
2022-03-06 07:41:09 +01:00
chrchr-github 27baa20f38
Fix FN: stlOutOfBounds (off by one) ()
* Fix  FN: stlOutOfBounds (off by one)

* Format

* Simplify
2022-03-04 17:13:13 +01:00
chrchr-github 2dd6c75b35
Fix Crash/nullptr deref in getEndOfExprScope() ()
* Fix  Crash/nullptr deref in getEndOfExprScope()

* Format
2022-03-03 17:08:23 +01:00
Daniel Marjamäki 915ae4b845 ValueFlow: Fix crash 2022-03-02 21:12:37 +01:00
Oliver Stöneberg 4a63af02ed
enabled functionConst and functionStatic in selfcheck ()
* fixed functionConst findings and enabled it in selfcheck

* fixed functionStatic findings and enabled it in selfcheck

* .travis_suppressions: adjusted comment

* testimportproject.cpp: added missing asserts
2022-03-02 07:46:47 +01:00
Paul Fultz II 0b310b9d07
Fix 10702: FP knownConditionTrueFalse - Member variable modified ()
* Fix 10702: FP knownConditionTrueFalse - Member variable modified

* Format

* Make parameter const

* Fix FP

* Fix FP

* Update

* Format
2022-02-28 18:54:55 +01:00
chrchr-github d79d6e60db
Fix Internal error. Token::Match called with varid 0 ()
* Fix  Internal error. Token::Match called with varid 0

* Fix test
2022-02-26 23:48:29 +01:00
Paul Fultz II dbc80787e1
Fix 10821: FN: containerOutOfBounds ()
* Fix 10821: FN: containerOutOfBounds

* Format

* Fix cppcheck warning

* Add valueflow tests

* Format

* Fix some bugs

* Format
2022-02-25 05:53:51 +01:00
Paul Fultz II 45de9a7d08
Refactor: Use getEndOfExprScope instead of getEndOfVarScope () 2022-02-24 06:50:34 +01:00
chrchr-github 172aafdeb8
Fix FN: redundant assignment in loop () 2022-02-22 09:51:44 +01:00
Paul Fultz II 1ac16413ea
Another fix for 10800: Hang / memory exhaustion on numerical code ()
* Another fix for 10800: Hang / memory exhaustion on numerical code

* Format
2022-02-22 07:21:26 +01:00
Oliver Stöneberg b6876d22e6
use inline suppressions for varid0 in selfcheck () 2022-02-21 18:35:02 +01:00
chrchr-github 734e3ac6da
Fix cppcheckError with for loop () 2022-02-21 18:14:20 +01:00
chrchr-github 6635e6cc07
Fix cppcheckError with for loop () 2022-02-17 22:12:19 +01:00
Paul Fultz II 78228599da
Fix 10800: Hang / memory exhaustion on numerical code ()
* Fix 10800: Hang / memory exhaustion on numerical code

* Format

* Add another test

* Format
2022-02-11 06:52:28 +01:00
Oliver Stöneberg f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly () 2022-02-10 23:02:24 +01:00
chrchr-github 24e9859158
Fix FP stlcstrParam due to incorrect overload resolution ()
* Fix  FP stlcstrParam due to incorrect overload resolution

* Variable shadowing
2022-02-10 11:17:06 +01:00
Paul Fultz II a50452517d
Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState() ()
* Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState()

* Format
2022-02-10 07:43:27 +01:00
Paul Fultz II 20a5224d7e
Fix 10784: False positive: returnDanglingLifetime using std::tie with variadic template parameters () 2022-02-08 09:03:51 +01:00
Paul Fultz II f2a419653c
Refactor ProgramMemory to store the expression tokens instead of exprIds () 2022-02-06 20:15:45 +01:00
Paul Fultz II 569332a50a
Fix 10786: False positive: arrayIndexOutOfBoundsCond () 2022-02-06 20:14:13 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Paul Fultz II 11387cbb41
Fix 10768: performance regression () 2022-02-02 13:01:44 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use () 2022-01-27 19:03:20 +01:00
Paul Fultz II 40147c1e4b
Fix 10719: Crash in valueFlowIterators() ()
* Fix 10719: Crash in valueFlowIterators()

* Format
2022-01-26 06:42:41 +01:00
Paul Fultz II 0737cc4d8c
Fix 10708: Assertion "!maxValue->isKnown()" from valueFlowInferCondition ()
* Fix 10708: Assertion "!maxValue->isKnown()" from valueFlowInferCondition

* Format
2022-01-21 09:56:24 +01:00
Paul Fultz II 7b793af451
Fix 10728: Crash in CheckStl::checkDereferenceInvalidIterator2 ()
* Fix 10728: Crash in CheckStl::checkDereferenceInvalidIterator2

* Format
2022-01-18 14:48:02 +01:00
Armin Müller 5a05631c84
Typos found by running "codespell" () 2022-01-13 17:24:26 +01:00
Paul Fultz II 4ef20f8f1e
Fix 10683: FP danglingTemporaryLifetime with pointer to vector () 2022-01-10 07:34:26 +01:00
Paul Fultz II fe7595cd9d
Fix 10677: crash during valueFlowInferCondition () 2022-01-09 22:43:08 +01:00
Paul Fultz II 0c9eb5d190
Fix 10681: FP ctuuninitvar with array member () 2022-01-08 10:47:28 +01:00
Oliver Stöneberg 0ba9cb4e64
fixed some unusedFunction warnings () 2022-01-04 15:48:08 +01:00
Paul Fultz II 50862d1ace
Fix 10665: Crash in ExpressionAnalyzer () 2022-01-02 08:09:23 +01:00
Paul Fultz II 0c952ca05d
Fix 10223: ValueFlow; known value for a volatile variable () 2022-01-01 23:15:14 +01:00
Paul Fultz II 73f24b43f9
Fix 10437: FP knownConditionTrueFalse after pointer check () 2021-12-20 07:28:40 +01:00
Paul Fultz II e7db974606
Fix 10621: FP arrayIndexOutOfBoundsCond with multiple index checks () 2021-12-17 21:48:29 +01:00
Paul Fultz II 4fb43a3f56
Fix 10643: FP: (error) Array 'buf[64]' accessed at index -1, which is out of bounds. ()
* Fix 10643: FP: (error) Array 'buf[64]' accessed at index -1, which is out of bounds.

* Format
2021-12-17 10:05:57 +01:00
Paul Fultz II 398fa28021
Fix 10657: False positive; ValueFlow - invalid iterator () 2021-12-16 22:34:51 +01:00
Oliver Stöneberg ba402f3e50
cleaned up includes based on include-what-you-use () 2021-12-15 19:47:27 +01:00
Paul Fultz II 5414814238
Fix 10649: False positive: wrong known value after reassignment () 2021-12-15 19:37:25 +01:00
Paul Fultz II 6681576707
Fix 10642: False positive: Possible dereference of an invalid iterator: v.begin()+v.size()-1 () 2021-12-15 19:31:28 +01:00
chrchr-github 532477cdb2
Fix FP knownConditionTrueFalse (bitshift) () 2021-12-14 07:30:57 +01:00
Paul Fultz II 3874c546cc
Fix 10641: FP invalidLifetime with compiler-generated constructor () 2021-12-07 07:43:25 +01:00
Paul Fultz II d2926bfa96
ValueFlow: Propagate const variables more aggressively ()
* ValueFlow: Propagate const variables more aggressively

* Format

* Fix incorrect addition
2021-12-06 09:16:42 +01:00
Paul Fultz II f64bcac004
Fix 10429: Regression: invalidIterator () 2021-12-05 15:46:52 +01:00
Paul Fultz II a03e731930
Track lifetimes of lambdas that capture the 'this' variable () 2021-12-04 17:00:55 +01:00
Paul Fultz II c14920218c
Fix 10624: FP knownConditionTrueFalse with pointer member and dynamic cast () 2021-12-04 08:54:24 +01:00
Paul Fultz II a0d633945e
Fix 10621: FP arrayIndexOutOfBoundsCond with multiple index checks ()
* Fix 10621: FP arrayIndexOutOfBoundsCond with multiple index checks

* Format
2021-12-04 08:54:04 +01:00
Paul Fultz II 57f5b19b34
Fix 7812: False negative: return pointer of local variable ()
* Fix 7812: False negative: return pointer of local variable

* Format

* Add test case for 3029

* Format
2021-11-28 15:25:21 +01:00
Paul Fultz II 143ddf2758
Fix 10595: FN: std::vector() reserve() ()
* Fix 10595: FN: std::vector() reserve()

* Format
2021-11-26 09:50:02 +01:00
Paul Fultz II 12e731ad49
Fix 10605: FP containerOutOfBounds with empty() check () 2021-11-25 22:34:00 +01:00
Paul Fultz II 33ad30f4da
Fix 10617, 9824: conditions in expanded macro () 2021-11-25 18:40:15 +01:00
Paul Fultz II a0d3c2c719
Handle for loop conditions in afterCondition () 2021-11-14 18:30:36 +01:00
Paul Fultz II 112363c9d1
Fix 10590: container access out of bounds not found ()
* Refactor container bounds check

* Use symbolic values

* Add test case

* Format
2021-11-13 07:45:29 +01:00
Paul Fultz II c057dcce0f
Fix 10592: False positive: returnDanglingLifetime () 2021-11-11 08:00:05 +01:00
Paul Fultz II 035c70c441
Fix 10578: Value not impossible after check () 2021-11-07 18:19:56 +01:00
Paul Fultz II 1791457227
Fix 9953: false positive: uninitvar () 2021-11-07 06:51:19 +01:00
Paul Fultz II 6338c2396c
Fix 10589: False positive: danglingLifetime for moved unique ptr () 2021-11-06 19:08:19 +01:00
Paul Fultz II ffc2a9d8e2
Fix 9735 for valueFlowUninit () 2021-11-06 19:06:07 +01:00
Daniel Marjamäki 0f259a5dc6 Fixed (regression: arrayIndexOutOfBounds) 2021-11-03 20:16:44 +01:00
Paul Fultz II d3f0aa5b34
Fix 10033: false negative: danglingTemporaryLifetime with usage of reference from nested object not detected () 2021-11-01 19:23:15 +01:00
Paul Fultz II be14866095
Run valueFlowSubfunction in reverse order of functions () 2021-11-01 19:21:03 +01:00
Paul Fultz II 04ecf53a07
Use static array to store iterator infer models instead of constructing a vector everytime () 2021-11-01 19:18:18 +01:00
Paul Fultz II df59b07ba1
Fix 10226: FN: knownConditionTrueFalse () 2021-10-31 14:51:07 +01:00
Paul Fultz II 8c9c46835a
Fix for 6597: false negative: uninitialized variable usage not detected (ValueFlow , multi variables) () 2021-10-30 22:13:58 +02:00
Paul Fultz II e20ddd55d6
Propagate partially uninit variables in ValueFlow () 2021-10-30 07:43:37 +02:00
Paul Fultz II 48fc70b810
Dont stop analysis when an unrelated class variable is changed () 2021-10-23 14:47:10 +02:00
Paul Fultz II ca83222bae
Add subexpression analyzer to set values for uninitialized members of struct ()
* Add subexpression analyzer

* Fix errors

* Add tests

* Format

* Add more tests

* Run members first

* Format

* Uncomment todo assert

* Formatting

* Use simpleMatch
2021-10-21 14:44:48 +02:00
chrchr-github c88dceff95
Partial fix for : set value for int s{ 4 }; () 2021-10-15 20:05:42 +02:00
Paul Fultz II 89515600e4
Fix 10538: FN: nullPointer (std::swap pointers) () 2021-10-15 10:58:16 +02:00
Paul Fultz II 130d1abbce
Fix 10210: FN: nullPointerRedundantCheck regression in member function () 2021-10-15 10:57:40 +02:00
Paul Fultz II f1f86db0da
Fix 10544: FP knownConditionTrueFalse with loop after check () 2021-10-14 16:47:15 +02:00
Paul Fultz II 6b9ef1fc58
Propagate symbolic values for identity operators () 2021-10-14 16:46:36 +02:00
Oliver Stöneberg 99db1f3f22
fixed some compiler warnings () 2021-10-13 12:10:26 +02:00
Paul Fultz II 52e4bec50a
Fix 10537: FN: knownConditionTrueFalse (std::string::c_str() never returns nullptr) () 2021-10-11 19:16:12 +02:00
Paul Fultz II 5e9bc48d26
Evaluate symbolic values () 2021-10-11 19:10:37 +02:00
Daniel Marjamäki 6bd5f79451 Revert "Fix 8629: false negative: (style) Condition '...' is always true ()"
This reverts commit b9be38aaec.
2021-10-10 21:21:21 +02:00
Paul Fultz II b9be38aaec
Fix 8629: false negative: (style) Condition '...' is always true () 2021-10-09 16:20:38 +02:00
Paul Fultz II bc90ae889d
Fix 10543: FP knownConditionTrueFalse with static variable () 2021-10-09 16:20:04 +02:00
Paul Fultz II a1e0ef9b38
Refactor: Use interval analysis for symbolic values for inferCondtion () 2021-10-09 16:19:06 +02:00
Paul Fultz II 25eb0ab5bc
Find dangling pointers to unique_ptr () 2021-10-06 08:46:25 +02:00
Paul Fultz II 3cb252bd99
Fix 9873: False negative: null pointer when checking raw pointer () 2021-10-06 08:39:58 +02:00
chrchr-github f3e1f0d41b
Fix : char* confused with char () 2021-10-05 18:04:48 +02:00
Paul Fultz II 8668d445c7
Add support for string_view () 2021-10-05 08:28:19 +02:00
Paul Fultz II c7e13d0e0b
Forward container size values in subfunctions () 2021-10-05 08:22:19 +02:00
KenPatrickLehrmann 61cddabe74
Fix FP due to namespace scope () 2021-10-04 23:16:16 +02:00
chrchr-github 428144c53c
Fix : vector constructed from pointers () 2021-10-04 07:55:17 +02:00
Paul Fultz II 7621fee3d4
Refactor: Use ValueFlow::Value for ProgramMemory execute instead of integers () 2021-10-04 07:53:58 +02:00
chrchr-github 609e20d9d8
ValueFlow: string can be constructed from init list () 2021-10-02 23:09:49 +02:00
Paul Fultz II 255dc0484a
Fix 10331: wrong conditional value after assignment+return () 2021-09-21 19:25:41 +02:00
Paul Fultz II 9e9a982c6c
Fix 10468: False positive; uninitialized variable. Loop is always executed at least once () 2021-09-18 22:23:05 +02:00
Paul Fultz II 9ece849d80
Fix 10467: FP mismatchingContainers with array of vectors () 2021-09-09 20:43:46 +02:00
Paul Fultz II b0b3f7ec2d
Fix 10464: FP: knownConditionTrueFalse () 2021-09-09 07:49:56 +02:00
Paul Fultz II 98e22f6162
Fix 10413: FP arrayIndexOutOfBoundsCond after check () 2021-09-06 07:15:24 +02:00
Paul Fultz II 0335671b35
Fix 10450: regression, FP : Iterator 'iter' from different container 'l' are used together () 2021-09-05 07:35:33 +02:00
Paul Fultz II ccb31d8510
Fix 10460: FP knownConditionTrueFalse 'fabs(x)<1/(double)16' is always false () 2021-09-05 07:10:58 +02:00
Paul Fultz II 928efe77fc
Fix 9765: FP: knownConditionTrueFalse handling of template function with ternary operator () 2021-09-04 19:55:36 +02:00
Paul Fultz II 28bc717cbe
Fix 10163: false positive: lifetime for r is not same as for seq 'for (auto& r: seq)' () 2021-09-04 19:53:14 +02:00
Paul Fultz II 9eb5eadd35
Fix 9777: False Positive: Condition is always true with reset/release on unique_ptr () 2021-09-04 19:06:13 +02:00
Paul Fultz II 8a708e556c
Fix 10456: FP identicalConditionAfterEarlyExit with variable captured by reference () 2021-09-04 19:05:41 +02:00
Paul Fultz II 7ce17f076a
Fix 10318: iterator converted to type, wrong scope check () 2021-08-31 09:48:23 +02:00
Paul Fultz II 4566e0e439
Fix 10148: False positive: knownConditionTrueFalse in for loop due to &= () 2021-08-28 09:28:29 +02:00
Paul Fultz II 740becbddf
Fix 10348: FP knownConditionTrueFalse with condition variable in do ... while loop () 2021-08-27 05:46:57 +02:00
Paul Fultz II 712ff1c073
Fix 10436: hang: valueFlowSubFunction 'ispunct(c)..' () 2021-08-27 05:46:33 +02:00
Paul Fultz II 1cd9d0479d
Fix 10433: assertion failure in ValueFlow (Interval::fromValues) () 2021-08-26 07:46:40 +02:00
Daniel Marjamäki 11916171fe Fix crash in programmemory, crash found in daca@home package system-root 2021-08-25 06:56:19 +02:00
Paul Fultz II f7ddd7a35d
Fix 10430: FP knownConditionTrueFalse with bool from unsigned char () 2021-08-25 04:51:54 +02:00
Paul Fultz II 8ddc5764f8
Fix 10425: False positive: returnDanglingLifetime when taking address of captured variable () 2021-08-25 04:06:03 +02:00
Daniel Marjamäki 37ef29889b Fix 10424: ExpressionAnalyzer assertion failure in librevisa 2021-08-24 16:06:51 +02:00
Paul Fultz II 524db1c756
Fix 10420: assertion error when analysing juce () 2021-08-23 11:12:42 +02:00
Paul Fultz II 865163b2ba
Add library configurations for free functions like std::size, std::empty, etc () 2021-08-23 09:03:48 +02:00
Daniel Marjamäki 165d48c846 fix gcc compiler warnings 2021-08-22 18:06:54 +02:00
Paul Fultz II a0c37ceba2
Fix FP: Set correct bounds for interval () 2021-08-21 21:17:05 +02:00
Paul Fultz II d30f42e0da
Fix FP when calling a function in a condition () 2021-08-21 18:52:11 +02:00
Paul Fultz II e62cdbb664
Deduce symbolic values from conditions () 2021-08-19 22:01:55 +02:00
Paul Fultz II e0de48bb1d
Fix 7524: ValueFlow: false path for 'x<3' () 2021-08-16 09:19:07 +02:00
Daniel Marjamäki 6a565f9e2f cleanup unused function 2021-08-15 11:01:14 +02:00
Paul Fultz II be978b35cf
Add more ValueFlow info in the xml dumps () 2021-08-15 08:02:31 +02:00
Paul Fultz II f81ddd2daa
Fix 10408: FP nullPointer on 'return x.release()' () 2021-08-15 07:43:50 +02:00
Paul Fultz II c92dab1329
Fix 10406: FP danglingLifetime with pointer-to-pointer () 2021-08-14 21:37:17 +02:00
Paul Fultz II b9ac48c90a
Fix 10409: FP 'Condition 's.size()<3' is always false' () 2021-08-14 06:48:38 +02:00
Paul Fultz II 69eaa9dfd9
Refactor: ConditionHandler cleanup () 2021-08-11 08:37:37 +02:00