Commit Graph

1377 Commits

Author SHA1 Message Date
chrchr-github 3ccd0505cd
Enable and mitigate readability-simplify-boolean-expr (#4897) 2023-03-17 13:51:55 +01:00
Paul Fultz II 8324caf8b9
Fix 11557: FP derefInvalidIteratorRedundantCheck in and/or condition (#4892) 2023-03-16 15:00:27 +01:00
Paul Fultz II 61e8b84578
Fix 11610: false negative: knownConditionTrueFalse with address of variable (#4883) 2023-03-12 19:57:11 +01:00
Mateusz Michalak 2d5cabed4b
Add std::*begin and std::*end cfg (#4796) 2023-03-09 17:06:53 +01:00
Oliver Stöneberg 00fd3d92c6
made `ForwardTraversal::mSettings` and `ReverseTraversal::mSettings` references / adjusted some calling code to use references as well (#4858) 2023-03-07 12:26:17 +01:00
Oliver Stöneberg 20db3ff368
SymbolDatabase: made `mTokenizer` and `mSettings` references (#4857) 2023-03-07 12:22:06 +01:00
Oliver Stöneberg 5af6ca6637
made `Platform` a member of `Settings` instead of inheriting from it / cleanups (#4791) 2023-03-03 18:36:27 +01:00
Oliver Stöneberg 8023eff7c0
removed `TokenList::getSettings()` and replaced usage in ValueFlow with provided settings (#4843) 2023-03-03 18:31:38 +01:00
Oliver Stöneberg b70e1d5461
avoid some unchecked pointer dereferences (#4811) 2023-03-02 22:05:41 +01:00
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` (#4599) 2023-03-02 21:50:14 +01:00
Oliver Stöneberg dac578e8b9
ValueFlow: avoid unnecessary `Value` copies (#4835) 2023-03-02 21:46:23 +01:00
chrchr-github 491299048b
Amend fix for #11449 Function call not recognized (#4838) 2023-03-02 21:45:15 +01:00
Oliver Stöneberg e99d7c6531
fixed some `-Wdeprecated-copy-dtor` Clang compiler warnings (#4836) 2023-03-02 21:02:29 +01:00
Daniel Marjamäki e5a22e3436 Revert "improved `Path` handling of mixed separators (#4808)"
This reverts commit 0797867758.
2023-02-24 06:21:02 +01:00
chrchr-github 96887c8130
Fix #11561 FN nullPointer with unnamed parameter (#4805) 2023-02-23 22:56:03 +01:00
Oliver Stöneberg 0797867758
improved `Path` handling of mixed separators (#4808) 2023-02-23 22:34:05 +01:00
Paul Fultz II 346ecdb53a
Improve valueflow after pushing to container (#4803) 2023-02-23 18:05:31 +01:00
Paul Fultz II 91d2526c41
Fix reverse analysis when modifying variable with function (#4800) 2023-02-23 18:04:16 +01:00
Mateusz Michalak 9b62caf0ef
Fix FP#11508 (#4774)
* Add tests to cover the issue

* Set lifetime of pointer to data passed as view to SubFunction

* Move isContainerOfPointers to separate function

* Revert "Set lifetime of pointer to data passed as view to SubFunction"

This reverts commit 30dafe23e40354606776d2573653608025cae754.

* Skip propagating lifetime of iterators/pointers for views

* Add indents to test cases

* Skip all non-local values in container view lifetime
2023-02-18 17:38:51 +01:00
chrchr-github ff0eee4d77
Fix #11558 FP knownConditionTrueFalse when checking for zero character (#4794)
* Fix #11558 FP knownConditionTrueFalse when checking for zero characte

* Fix test

* Set impossible value only for non-Boolean conditions, rename

* Fix condition
2023-02-18 17:35:12 +01:00
Paul Fultz II 2b9af94b9a
Fix 11548: FP knownConditionTrueFalse with empty() == false (#4788)
* Fix 11548: FP knownConditionTrueFalse with empty() == false

* Format

* Fix test
2023-02-11 10:42:13 +01:00
Oliver Stöneberg f7a415dbf3
Token: do not return non-`const` pointer from `const` methods - part 1 (#4761) 2023-02-08 21:07:16 +01:00
chrchr-github 4f915499d4
Fix #11091 FP: Using object that is a temporary (#4754) 2023-02-06 22:04:27 +01:00
Oliver Stöneberg afd13ea11d
ValueFlow: some interface and namespace cleanups (#4746) 2023-01-28 10:20:47 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg bea6aec2b2
extracted `ValueFlow::Value` to `vfvalue.{cpp|h}` (#4642) 2023-01-26 22:23:22 +01:00
chrchr-github 3076f9def1
Fix #11449 Function call not recognized with extra parentheses / FP nullPointer (#4703) 2023-01-18 20:38:37 +01:00
Armin Müller a77f0d9403
Typos found by running "codespell" (#4702) 2023-01-10 15:15:27 +01:00
Paul Fultz II cefc105c5f
Fix 11468: false positive danglingTempReference warning (#4679) 2023-01-07 23:44:22 +01:00
Paul Fultz II 6020feb271
Fix 11461: arrayIndexOutOfBounds false positive (#4686) 2023-01-07 22:09:17 +01:00
Paul Fultz II a338be4682
Add source traces when using LifetimeStore (#4678) 2023-01-03 22:02:48 +01:00
chrchr-github 11f1a9d1f5
Fix crash on ternary with omitted operand (#4673)
* Fix MSVC compiler warning

* Fix crash on incomplete ternary operator

* Revert "Fix crash on incomplete ternary operator"

This reverts commit 28df0f0ab6ff794e733617447f847a97c1a7a609.

* Handle ternary with omitted operand
2023-01-02 17:44:17 +01:00
Oliver Stöneberg 71cdacdc97
fixed missing location for `valueFlowMaxIterations` debug warning / also added it to daca server overview (#4664) 2022-12-30 21:20:00 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
Oliver Stöneberg b380fd2589
added command-line option `--valueflow-max-iterations` to control amount of valueflow iterations / also log debug warning when iterations are being exceeded (#4557) 2022-12-20 20:51:08 +01:00
Oliver Stöneberg 3c68b9b29f
use `cbegin()` and `cend()` with `const_ierator` loops (#4658) 2022-12-20 20:32:16 +01:00
Paul Fultz II 9da574f4a0
Fix 11227: ValueFlow: Known value not set in condition for ternary operator (#4653)
* Evaluate args before function call

* Fix tests

* Format

* Add test for 11227

* Format

* Fix known condition
2022-12-18 22:07:43 +01:00
Oliver Stöneberg dc5c5de10e
avoid some unnecessary copies (#4589) 2022-12-18 19:38:29 +01:00
chrchr-github b1abaf8809
Fix FP useStlAlgorithm (don't suggest std::accumulate when nothing is accumulated) (#4647) 2022-12-18 16:52:04 +01:00
Daniel Marjamäki 7799f820a3 Refactoring: Use static for local function getMinMaxValues 2022-12-17 21:21:18 +01:00
Paul Fultz II e2f398f81a
Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) ) (#4636)
* Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) )

* Format
2022-12-13 07:52:58 +01:00
Paul Fultz II b4d455df48
Fix 11349: FP negativeIndex for clamped array index (#4627)
* Fix 11349: FP negativeIndex for clamped array index

* Format

* Use emplace_back

* Use default constructor
2022-12-13 07:50:01 +01:00
Paul Fultz II 3f88744851
Fix 11358: FP containerOutOfBounds for container passed by pointer (#4626) 2022-12-09 19:43:21 +01:00
Paul Fultz II 6eccb2e36c
Throw internal error when tokens are not in order (#4623)
* Throw internal error when tokens are not in order

* Add semicolon
2022-12-09 07:17:16 +01:00
Paul Fultz II 7acbb656f3
Fix 11412: False positive: uninitvar (#4624)
* Dont remove modified variables from dead code

* Add test for 11412

* Format
2022-12-09 07:15:47 +01:00
Paul Fultz II c150317f02
Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement (#4625)
* Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement

* Format
2022-12-09 07:15:15 +01:00
Paul Fultz II 0cb742701d
Fix 11415: FP containerOutOfBounds for container initialized in virtual method (#4622) 2022-12-08 20:10:58 +01:00
chrchr-github 04b7c0c200
Fix #11404 FP knownConditionTrueFalse with iterator (#4619)
* Fix wrong value set in valueFlowSameExpressions()

* Fix  #11404 FP knownConditionTrueFalse with iterator
2022-12-08 10:40:55 +01:00
chrchr-github 7d6683fb78
Fix #11417 FP knownConditionTrueFalse with container and brace init (#4606)
* Fix #11417 FP knownConditionTrueFalse with container and brace init

* Format

* Format

* Move to getInitListSize()
2022-12-02 22:07:08 +01:00
chrchr-github 3273e51fd5
Fix #10412 FN useStlAlgorithm with iterators (#4157) 2022-10-16 13:46:26 +02:00
chrchr-github 6c24d2b865
Fix #11321 FP uninitvar for in-class member initialization (#4547) 2022-10-14 19:48:27 +02:00
Daniel Marjamäki ca32cf11ba Fix handling of --performance-valueflow-max-time=T 2022-10-04 20:01:19 +02:00
Daniel Marjamäki 8686997292 Add experimental option --performance-valueflow-max-time=T 2022-10-04 14:02:55 +02:00
Oliver Stöneberg cff1cd9cda
applied clang-tidy `misc-const-correctness` fixes for POD types, iterators and references (#4529)
* applied `misc-const-correctness` fixes for POD types and iterators

* applied `misc-const-correctness` fixes for references
2022-10-02 07:12:40 +02:00
Oliver Stöneberg eeb6db05f1
avoid some unnecessary object creations and copies (#4493) 2022-09-29 21:47:17 +02:00
Oliver Stöneberg 0481edf9c3
return `SmallVector` from `followAllReferences()` (#3925) 2022-09-29 21:41:32 +02:00
Oliver Stöneberg b9e07e918e
enabled and fixed `readability-named-parameter` clang-tidy warnings (#4487) 2022-09-27 20:03:25 +02:00
Paul Fultz II 09944c0b7e
Fix 11298: FP danglingTemporaryLifetime when constructing from const char* (#4479)
* Fix 11298: FP danglingTemporaryLifetime when constructing from const char*

* Format
2022-09-18 08:30:58 +02:00
Paul Fultz II de7d02293f
Fix 11308: FP accessMoved with virtual function (#4478)
* Fix 11308: FP accessMoved with virtual function

* Format
2022-09-18 08:30:06 +02:00
Paul Fultz II d34de745c0
Fix 11306: FP knownConditionTrueFalse with strlen() (#4477)
* Fix 11306: FP knownConditionTrueFalse with strlen()

* Add another test
2022-09-18 08:29:10 +02:00
Oliver Stöneberg 339484d2a1
mitigated and enabled more clang-tidy warnings (#4470)
* fixed some `performance-inefficient-string-concatenation` clang-tidy warnings

* fixed and enabled `modernize-replace-random-shuffle` clang-tidy warning

* fixed and enabled `bugprone-suspicious-string-compare` clang-tidy warning

* mitigated and enabled `readability-non-const-parameter` clang-tidy warnings

* clang-tidy.md: documented some disabled checks

* mitigated and enabled `performance-unnecessary-value-param` clang-tidy warnings
2022-09-16 18:58:59 +02:00
Oliver Stöneberg b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes (#4466)
* iwyu.yml: use debian:unstable to always get latest include-what-you-use

* cleaned up includes based on include-what-you-use

* mitigated include-what-you-use false positives
2022-09-16 07:15:49 +02:00
chrchr-github e904f7341e
Fix ValueFlow crash (#4461) 2022-09-13 12:25:15 +02:00
Oliver Stöneberg 76d1b9f31a
avoid unnecessary copies with `emplace_back()` (#4450)
* avoid unnecessary copies with `emplace_back()`

* cmdlineparser.cpp: suppress `accessMoved` selfcheck false positives
2022-09-10 11:25:15 +02:00
Paul Fultz II 53820515c9
Set valueflow for container elements (#4455)
* Track elements to containers

* Format

* Handle other access methods

* Format
2022-09-10 09:26:44 +02:00
Paul Fultz II 117a753b10
Partial fix 11154: FN: knownConditionTrueFalse (#4453)
* Partial fix 11154: FN: knownConditionTrueFalse

* Formay

* Add more tests

* FOrmat

* Fix FP

* Add test

* Check for side effects

* Format

* Update tests

* Format
2022-09-08 22:08:38 +02:00
Oliver Stöneberg dbc05da356
fixed some clang-tidy warnings (#4435) 2022-09-08 20:01:41 +02:00
Paul Fultz II 7c986fbef1
Fix 11203: false positive: knownConditionTrueFalse 'always false' when comparing integer with floating-point (#4350) 2022-09-08 19:59:02 +02:00
Paul Fultz II f83b8dd385
Fix 11194: FN: knownConditionTrueFalse (#4452)
* Fix 11194: FN: knownConditionTrueFalse

* Format
2022-09-08 18:51:44 +02:00
Oliver Stöneberg d46ea7ba86
avoid unnecessary copies with `push_back()` and `push_front()` (#4451) 2022-09-08 09:21:35 +02:00
Paul Fultz II 32d96104d6
Fix 6370: ValueFlow: array element with known value (#4447)
* Fix 6370: ValueFlow: array element with known value

* Format

* Move comment
2022-09-07 19:16:07 +02:00
Paul Fultz II 6543b429c5
Fix 11285: FN: zerodiv (#4448)
* Fix 11285: FN: zerodiv

* Format
2022-09-07 19:15:37 +02:00
chrchr-github 6960332f8a
Fix #11294 FP arrayIndexOutOfBoundsCond with extra parentheses (#4442) 2022-09-06 21:21:06 +02:00
Paul Fultz II 2d37a77281
Fix 11296: FN: knownConditionTrueFalse ( a !=0 && b != 0 && a == 0) (#4444) 2022-09-06 07:31:48 +02:00
Paul Fultz II 6ce5c24f21
Refactor knownConditionTrueFalse check and isUsedAsBool function (#4432)
* Refactor knownConditionTrueFalse check and isUsedAsBool function

* Format1

* Format

* Skip assign
2022-09-04 10:24:45 +02:00
chrchr-github 456c6b410e
Fix #2304 FN known strcpy parameter (#4396)
* Fix #2304 FN known strcpy parameter

* Parentheses

* Format
2022-08-24 21:23:45 +02:00
Oliver Stöneberg 0e1cd8b2ac
do not do C++ processing for C code in `parsedecl()` (#4304) 2022-08-21 17:11:22 +02:00
Oliver Stöneberg d73a33d17e
avoid redundant `Token::declEndToken()` calls (#4363) 2022-08-20 20:50:14 +02:00
Oliver Stöneberg 16f598c409
added missing `sstream` includes (#4381) 2022-08-19 10:16:23 +02:00
chrchr-github 6a0c254d1f
Fix #9931 FP zerodiv (daca@home) (#4379)
* Fix #9931 FP zerodiv (daca@home)

* Format

* Parentheses

* clang-tidy
2022-08-18 20:38:36 +02:00
Oliver Stöneberg 98b9f2cbf1
reduced scope of some variables and avoided some copies (#4328) 2022-08-16 22:28:39 +02:00
Paul Fultz II bfd9470600
Fix 11158: FP zerodiv in loop (#4356)
* Fix 11158: FP zerodiv in loop

* Format

* Add another test

* Format

* Fix FP

* Format
2022-08-13 08:27:20 +02:00
Paul Fultz II c0f55a2b85
Fix 11142: FP nullPointer before assignment (#4319)
* Fix 11142: FP nullPointer before assignment

* Format

* Use simpleMatch
2022-08-03 19:05:07 +02:00
Oliver Stöneberg efaaa58896
fixed some `modernize-use-emplace` false negatives and some `bugprone-assignment-in-if-condition` warnings (#4311) 2022-07-28 22:53:59 +02:00
Oliver Stöneberg b65b47d3a8
enabled and fixed `modernize-pass-by-value` clang-tidy warnings (#4169) 2022-07-28 22:51:45 +02:00
chrchr-github c340b6ae6c
Fix #11191 FP moduloofone with pow() (#4312) 2022-07-28 22:11:23 +02:00
Oliver Stöneberg 0005be1dbf
some cleanups (#4308) 2022-07-26 08:28:55 +02:00
Oliver Stöneberg b2f15fdbb1
reduced padding in some classes/structs (#4295) 2022-07-24 10:17:11 +02:00
chrchr-github 5342e2cd03
Fix #11037 FP knownConditionTrueFalse with dynamic_cast (#4297) 2022-07-20 20:48:17 +02:00
Oliver Stöneberg 4316884123
valueflow.cpp: avoid some copies related to `ErrorPath` (#4160) 2022-07-20 10:57:49 +02:00
chrchr-github 9e74da6126
Fix #11098 FP compare with negated constant (#4282) 2022-07-16 07:28:15 +02:00
Armin Müller 0ae9877766
Typos found by running "codespell" (#4260) 2022-07-10 22:40:05 +02:00
chrchr-github f5c4a21eae
Fix #10704 FN redundantCopyLocalConst (#4115) 2022-07-10 11:33:24 +02:00
Paul Fultz II edebe746bc
Fix 10361: false negative: uninitvar (std::next(iterator)) (#4256) 2022-07-09 07:39:04 +02:00
Paul Fultz II 0b63e7273d
Fix 11162: FP: knownConditionTrueFalse (#4254)
* 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 (#4222) 2022-06-19 08:17:05 +02:00
Paul Fultz II e6fdcb9de2
Refactor to use derefShared (#4220) 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 (#4217)
* 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 (#4216)
* 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 (#4215)
* 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 (#4209) 2022-06-12 07:17:28 +02:00
Paul Fultz II cee48e5e19
Add backtrace to valueflow in debug mode (#4195) 2022-06-12 07:13:42 +02:00
Paul Fultz II 653a1ea83e
Fix 11100: FP knownConditionTrueFalse with getter/setter member functions (#4198)
* 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 (#4184)
Merged from LCppC.
2022-06-11 08:11:16 +02:00
Paul Fultz II c9b85010f9
Fix 11096: FP knownConditionTrueFalse in do while loop (#4192)
* 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 (#4182)
* 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 (#4168) 2022-06-03 21:32:39 +02:00
Paul Fultz II 72342de0da
Fix 11114: FP knownConditionTrueFalse across functions (#4163)
* 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 (#4159)
* 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 (#4128) 2022-05-29 19:57:10 +02:00
Paul Fultz II 7405ea039d
Refactor valueflow forward and reverse functions and unify them (#4127)
* 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 (#4124)
* 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 (#4113)
* 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 (#4036) 2022-05-15 12:42:29 +02:00
Paul Fultz II fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member (#4103)
* 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 (#3080) 2022-05-08 20:42:06 +02:00
Paul Fultz II 843f7893d6
Fix 11040: FP nullPointer after loop (#4085) 2022-05-05 06:55:02 +02:00
Paul Fultz II 5afd6880c3
Fix 11028: False positive: invalidContainer (#4083)
* Fix 11028: False positive: invalidContainer

* Format
2022-05-05 06:54:36 +02:00
Paul Fultz II 496b45f27b
Fix 11009: FP uninitvar (#4076)
* 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 (#4072) 2022-05-03 11:42:32 +02:00
Paul Fultz II 3e686103ae
Fix 10984: False positive: invalidContainer when explictly capturing vector by reference (#4064) 2022-04-30 09:36:28 +02:00
Paul Fultz II 4e7125554f
Fix 8358: FP: Condition '(number*0)!=0' is always false (#4065) 2022-04-30 09:35:51 +02:00
Paul Fultz II 9fa5c4e201
Fix 11011: FP returnDanglingLifetime with non-const reference argument [inconclusive] (#4066)
* 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 (#4056) 2022-04-28 10:48:37 +02:00
chrchr-github bcbc29affb
Fix #10526 FP: negativeIndex if function call is made after index check (#4052)
* Fix #10526 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 (#4044) 2022-04-26 17:57:06 +02:00
Paul Fultz II 5d5562266d
ValueFlow: Assume constant is nonzero when its negated (#4041)
* ValueFlow: Assume constant is nonzero when its negated

* Format

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

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

* Fix flag check

* Use isStatic()

* Fix #10979 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 (#4023) 2022-04-14 18:13:04 +02:00
Paul Fultz II 09597bc7e8
Fix 10956: ValueFlow: Incorrect value when assigned to two variables (#4019)
* 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 (#4007)
* 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() (#4006) 2022-04-12 08:09:13 +02:00
Paul Fultz II 61b87bcc60
Fix 10955: False positive: containerOutOfBounds when using a const reference member (#4005) 2022-04-12 08:07:55 +02:00
Paul Fultz II d97942d3c6
Fix 6577: Detect pointer to uninitialised memory with clock_settime() (#3993)
* 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 (#3991) 2022-04-10 22:47:58 +02:00
Oliver Stöneberg 25ef9eeb26
use std::string::empty() (#3910) 2022-04-09 19:02:37 +02:00
Paul Fultz II 4c1aeb0cb1
Remove old pointer alias check (#3983) 2022-04-07 11:36:15 +02:00
chrchr-github 52b4aeb279
Fix #10792 FP knownConditionTrueFalse with double to int cast (#3964) 2022-04-07 10:42:57 +02:00
Paul Fultz II dad10f2ab7
Fix 7684: ValueFlow: function call 'X::GetSize()' (#3984)
* 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 (#3981)
* 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 (#3979)
* 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) (#3977)
* 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) (#3976)
* Fix 10867: false negative: containerOutOfBounds with std::array (regression)

* Format
2022-04-06 06:25:28 +02:00
chrchr-github cfbbeb4b1b
Partial fix for #10867 FN containerOutOfBounds with std::array (#3971)
* Partial fix for #10867 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 (#3968)
* 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 #10849 FP constStatement with pointers in lambda (#3961) 2022-04-01 19:50:40 +02:00
Paul Fultz II 32ded1602b
Fix warnings in switch statements on clang (#3943) 2022-03-30 19:30:02 +02:00