Commit Graph

1102 Commits

Author SHA1 Message Date
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
Paul Fultz II 0f897acecd
Fix FP in solveExpr when using symbolic values () 2021-08-09 20:41:10 +02:00
Paul Fultz II a218ea3b23
Fix 10404: FP knownConditionTrueFalse after subtraction () 2021-08-09 07:45:41 +02:00
Daniel Marjamäki 5f81b03df1 valueflow; Remove unused function, fixing gcc warning 2021-08-08 21:25:47 +02:00
Daniel Marjamäki fa398a6ba1 valueflow: remove not needed INDENT-OFF and INDENT-ON 2021-08-08 21:22:42 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify () 2021-08-07 20:51:18 +02:00
Paul Fultz II 735f716603
Fix 10394 and 10395: FP knownConditionTrueFalse: loop variable () 2021-08-04 21:07:55 +02:00
Paul Fultz II 8b8ae55490
Fix 10129: false negative: knownConditionTrueFalse ()
* Add symbolic matching

* Check for truncated values

* Dont propagate uninit values

* Update errorpath test

* Add test case for 10129

* Add test case for FP

* Remove symbolic values that are the same as the token

* Fix test messages

* Fix cppcheck issue

* Format
2021-08-04 21:07:31 +02:00
Paul Fultz II 4626f9ed76
Fix FP when returning a pointer to a container () 2021-08-04 08:16:31 +02:00
Paul Fultz II 6736ac7e3a
Revert "Formatted the code [ci skip]" ()
This reverts commit 7a6d7f7c2d.
2021-08-03 17:53:30 +02:00
orbitcowboy 7a6d7f7c2d Formatted the code [ci skip] 2021-08-03 06:33:54 +02:00
Paul Fultz II 08041e3a0b
Refactor: Assert an expression has an id and fix assertion failures ()
* Fix 10390: FP: knownConditionTrueFalse

* Assert expression has an ID

* Fix assertion errors

* Format
2021-08-03 06:31:52 +02:00
Paul Fultz II 7be9b217e6
Fix 7843 and 7844: ValueFlow for abs ()
* Refactor: Use valueFlowForward to forward values in condition expression

* Formattting

* Make known when using bools as well

* Set abs function as always positive

* Add test

* Add valueFlowSymbolicAbs

* Set impossible values

* Fix test case

* Fix error messages

* Merge
2021-08-03 06:31:28 +02:00
Paul Fultz II 3d19b33c3e
Fix 9948 and 10234: false negative: knownConditionTrueFalse and stlOutOfBounds () 2021-08-02 10:51:34 +02:00
Paul Fultz II 61ceff39f5
Fix 10390: FP: knownConditionTrueFalse () 2021-08-02 10:49:39 +02:00
Daniel Marjamäki 1ec7397c21 astyle formatting
[ci skip]
2021-08-01 14:05:30 +02:00
Paul Fultz II 2f6a6e4b45
Refactor: Use valueFlowForward to forward values in condition expression () 2021-08-01 10:13:14 +02:00
Paul Fultz II 7d9fdf582b
Fix 10121: False positive: Condition 'ab->a!=123' is always false when modifying an alias () 2021-08-01 10:10:11 +02:00
Paul Fultz II 6767b57d4c
Fix FP for symbolic values when the expression is not const () 2021-07-31 14:19:37 +02:00
Paul Fultz II 3a7ba3cd29
Add symbolic values to ValueFlow () 2021-07-30 21:29:35 +02:00
Paul Fultz II 6a81b4c17c
Fix 10264: FP invalidContainer when address of container is passed inside struct () 2021-07-30 15:52:00 +02:00
Paul Fultz II 737b6199ba
Refactor: Allow parse to return multiple values for a condition () 2021-07-26 22:23:19 +02:00
Paul Fultz II c34691ff56
Fix 10354: FP knownConditionTrueFalse after bitwise and/xor () 2021-07-26 22:22:50 +02:00
Paul Fultz II 84ea0a2295
Refactor: Remove extra analysis of container sizes in conditions () 2021-07-25 18:14:51 +02:00
Paul Fultz II 5be3f700bb
Fix 10373: ValueFlow: container in struct assumed empty () 2021-07-25 18:13:55 +02:00
Paul Fultz II 8e416a7255
Fix issue 10379: FP knownConditionTrueFalse with mod operator () 2021-07-25 18:13:14 +02:00
Paul Fultz II 00eb71fd49
Remove constexpr -> const simplification () 2021-07-22 07:22:26 +02:00
Paul Fultz II 8efe1d4ab4
Find reference to dangling unique ptr () 2021-07-20 21:30:27 +02:00
Daniel Marjamäki dd34d1c123 CI; Fix Cppcheck self-check, pointer can be const 2021-07-20 11:21:47 +02:00
orbitcowboy 1be5bb8bbc Running astyle [ci skip] 2021-07-18 10:01:22 +02:00
Paul Fultz II 59a1c1a9d8
Refactor: Remove variable analyzer () 2021-07-18 07:46:31 +02:00
orbitcowboy 3f1e937ea1 Running astyle [ci skip] 2021-07-17 08:19:04 +02:00
chrchr-github 8cd8b9c64e
Fix MSVC build and some warnings () 2021-07-16 21:55:12 +02:00
Paul Fultz II 942202aede
Evaluate container sizes in forward analysis () 2021-07-16 18:49:07 +02:00
Daniel Marjamäki 56924643be Fixed (ValueFlow: No known value set for sizeof(a[0])) 2021-07-08 18:18:44 +02:00
Armin Müller fc90598077
Typos found by running "codespell" () 2021-07-02 17:41:51 +02:00
Daniel Marjamäki 1a5449cbeb Fixed (ValueFlow; Wrong Uninit value in called function) 2021-07-01 22:08:00 +02:00
Daniel Marjamäki 2a2e071a85 Tokenizer::simplifyAttribute; Set function attribute for function pointer 2021-06-26 14:23:39 +02:00
Paul Fultz II 66956ed959
Fix 10323: Wrong known value. x!=0 does not mean that x==1 () 2021-06-26 09:16:45 +02:00
Paul Fultz II 508188df2b
Fix 10297: Regression; ValueFlow known value, sign conversion () 2021-06-26 09:16:04 +02:00
Daniel Marjamäki 769b20b426 ValueFlow: Clarify note when impossible value is assigned () 2021-06-24 17:10:06 +02:00
Daniel Marjamäki 2d08564c8a astyle formatting 2021-06-19 14:47:35 +02:00
Paul Fultz II dd178c3ad9
Fix 10314: Possible nullPointerRedundantCheck false positive () 2021-06-19 13:59:48 +02:00