Commit Graph

1141 Commits

Author SHA1 Message Date
Paul Fultz II 0737cc4d8c
Fix 10708: Assertion "!maxValue->isKnown()" from valueFlowInferCondition (#3736)
* 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 (#3721)
* Fix 10728: Crash in CheckStl::checkDereferenceInvalidIterator2

* Format
2022-01-18 14:48:02 +01:00
Armin Müller 5a05631c84
Typos found by running "codespell" (#3702) 2022-01-13 17:24:26 +01:00
Paul Fultz II 4ef20f8f1e
Fix 10683: FP danglingTemporaryLifetime with pointer to vector (#3685) 2022-01-10 07:34:26 +01:00
Paul Fultz II fe7595cd9d
Fix 10677: crash during valueFlowInferCondition (#3687) 2022-01-09 22:43:08 +01:00
Paul Fultz II 0c9eb5d190
Fix 10681: FP ctuuninitvar with array member (#3686) 2022-01-08 10:47:28 +01:00
Oliver Stöneberg 0ba9cb4e64
fixed some unusedFunction warnings (#3618) 2022-01-04 15:48:08 +01:00
Paul Fultz II 50862d1ace
Fix 10665: Crash in ExpressionAnalyzer (#3661) 2022-01-02 08:09:23 +01:00
Paul Fultz II 0c952ca05d
Fix 10223: ValueFlow; known value for a volatile variable (#3658) 2022-01-01 23:15:14 +01:00
Paul Fultz II 73f24b43f9
Fix 10437: FP knownConditionTrueFalse after pointer check (#3646) 2021-12-20 07:28:40 +01:00
Paul Fultz II e7db974606
Fix 10621: FP arrayIndexOutOfBoundsCond with multiple index checks (#3640) 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. (#3639)
* 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 (#3636) 2021-12-16 22:34:51 +01:00
Oliver Stöneberg ba402f3e50
cleaned up includes based on include-what-you-use (#3627) 2021-12-15 19:47:27 +01:00
Paul Fultz II 5414814238
Fix 10649: False positive: wrong known value after reassignment (#3631) 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 (#3630) 2021-12-15 19:31:28 +01:00
chrchr-github 532477cdb2
Fix #9549 FP knownConditionTrueFalse (bitshift) (#3616) 2021-12-14 07:30:57 +01:00
Paul Fultz II 3874c546cc
Fix 10641: FP invalidLifetime with compiler-generated constructor (#3609) 2021-12-07 07:43:25 +01:00
Paul Fultz II d2926bfa96
ValueFlow: Propagate const variables more aggressively (#3606)
* 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 (#3603) 2021-12-05 15:46:52 +01:00
Paul Fultz II a03e731930
Track lifetimes of lambdas that capture the 'this' variable (#3594) 2021-12-04 17:00:55 +01:00
Paul Fultz II c14920218c
Fix 10624: FP knownConditionTrueFalse with pointer member and dynamic cast (#3598) 2021-12-04 08:54:24 +01:00
Paul Fultz II a0d633945e
Fix 10621: FP arrayIndexOutOfBoundsCond with multiple index checks (#3597)
* 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 (#3583)
* 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() (#3581)
* 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 (#3572) 2021-11-25 22:34:00 +01:00
Paul Fultz II 33ad30f4da
Fix 10617, 9824: conditions in expanded macro (#3578) 2021-11-25 18:40:15 +01:00
Paul Fultz II a0d3c2c719
Handle for loop conditions in afterCondition (#3561) 2021-11-14 18:30:36 +01:00
Paul Fultz II 112363c9d1
Fix 10590: container access out of bounds not found (#3560)
* 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 (#3557) 2021-11-11 08:00:05 +01:00
Paul Fultz II 035c70c441
Fix 10578: Value not impossible after check (#3549) 2021-11-07 18:19:56 +01:00
Paul Fultz II 1791457227
Fix 9953: false positive: uninitvar (#3548) 2021-11-07 06:51:19 +01:00
Paul Fultz II 6338c2396c
Fix 10589: False positive: danglingLifetime for moved unique ptr (#3547) 2021-11-06 19:08:19 +01:00
Paul Fultz II ffc2a9d8e2
Fix 9735 for valueFlowUninit (#3538) 2021-11-06 19:06:07 +01:00
Daniel Marjamäki 0f259a5dc6 Fixed #10222 (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 (#3542) 2021-11-01 19:23:15 +01:00
Paul Fultz II be14866095
Run valueFlowSubfunction in reverse order of functions (#3540) 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 (#3539) 2021-11-01 19:18:18 +01:00
Paul Fultz II df59b07ba1
Fix 10226: FN: knownConditionTrueFalse (#3537) 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) (#3535) 2021-10-30 22:13:58 +02:00
Paul Fultz II e20ddd55d6
Propagate partially uninit variables in ValueFlow (#3533) 2021-10-30 07:43:37 +02:00
Paul Fultz II 48fc70b810
Dont stop analysis when an unrelated class variable is changed (#3518) 2021-10-23 14:47:10 +02:00
Paul Fultz II ca83222bae
Add subexpression analyzer to set values for uninitialized members of struct (#3517)
* 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 #10358: set value for int s{ 4 }; (#3506) 2021-10-15 20:05:42 +02:00
Paul Fultz II 89515600e4
Fix 10538: FN: nullPointer (std::swap pointers) (#3504) 2021-10-15 10:58:16 +02:00
Paul Fultz II 130d1abbce
Fix 10210: FN: nullPointerRedundantCheck regression in member function (#3512) 2021-10-15 10:57:40 +02:00
Paul Fultz II f1f86db0da
Fix 10544: FP knownConditionTrueFalse with loop after check (#3508) 2021-10-14 16:47:15 +02:00
Paul Fultz II 6b9ef1fc58
Propagate symbolic values for identity operators (#3497) 2021-10-14 16:46:36 +02:00
Oliver Stöneberg 99db1f3f22
fixed some compiler warnings (#3502) 2021-10-13 12:10:26 +02:00
Paul Fultz II 52e4bec50a
Fix 10537: FN: knownConditionTrueFalse (std::string::c_str() never returns nullptr) (#3498) 2021-10-11 19:16:12 +02:00
Paul Fultz II 5e9bc48d26
Evaluate symbolic values (#3495) 2021-10-11 19:10:37 +02:00
Daniel Marjamäki 6bd5f79451 Revert "Fix 8629: false negative: (style) Condition '...' is always true (#3492)"
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 (#3492) 2021-10-09 16:20:38 +02:00
Paul Fultz II bc90ae889d
Fix 10543: FP knownConditionTrueFalse with static variable (#3491) 2021-10-09 16:20:04 +02:00
Paul Fultz II a1e0ef9b38
Refactor: Use interval analysis for symbolic values for inferCondtion (#3488) 2021-10-09 16:19:06 +02:00
Paul Fultz II 25eb0ab5bc
Find dangling pointers to unique_ptr (#3486) 2021-10-06 08:46:25 +02:00
Paul Fultz II 3cb252bd99
Fix 9873: False negative: null pointer when checking raw pointer (#3485) 2021-10-06 08:39:58 +02:00
chrchr-github f3e1f0d41b
Fix #10238: char* confused with char (#3484) 2021-10-05 18:04:48 +02:00
Paul Fultz II 8668d445c7
Add support for string_view (#3480) 2021-10-05 08:28:19 +02:00
Paul Fultz II c7e13d0e0b
Forward container size values in subfunctions (#3483) 2021-10-05 08:22:19 +02:00
KenPatrickLehrmann 61cddabe74
Fix FP due to namespace scope (#3475) 2021-10-04 23:16:16 +02:00
chrchr-github 428144c53c
Fix #10513: vector constructed from pointers (#3473) 2021-10-04 07:55:17 +02:00
Paul Fultz II 7621fee3d4
Refactor: Use ValueFlow::Value for ProgramMemory execute instead of integers (#3477) 2021-10-04 07:53:58 +02:00
chrchr-github 609e20d9d8
ValueFlow: string can be constructed from init list (#3459) 2021-10-02 23:09:49 +02:00
Paul Fultz II 255dc0484a
Fix 10331: wrong conditional value after assignment+return (#3461) 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 (#3462) 2021-09-18 22:23:05 +02:00
Paul Fultz II 9ece849d80
Fix 10467: FP mismatchingContainers with array of vectors (#3453) 2021-09-09 20:43:46 +02:00
Paul Fultz II b0b3f7ec2d
Fix 10464: FP: knownConditionTrueFalse (#3452) 2021-09-09 07:49:56 +02:00
Paul Fultz II 98e22f6162
Fix 10413: FP arrayIndexOutOfBoundsCond after check (#3446) 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 (#3436) 2021-09-05 07:35:33 +02:00
Paul Fultz II ccb31d8510
Fix 10460: FP knownConditionTrueFalse 'fabs(x)<1/(double)16' is always false (#3445) 2021-09-05 07:10:58 +02:00
Paul Fultz II 928efe77fc
Fix 9765: FP: knownConditionTrueFalse handling of template function with ternary operator (#3443) 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)' (#3442) 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 (#3440) 2021-09-04 19:06:13 +02:00
Paul Fultz II 8a708e556c
Fix 10456: FP identicalConditionAfterEarlyExit with variable captured by reference (#3439) 2021-09-04 19:05:41 +02:00
Paul Fultz II 7ce17f076a
Fix 10318: iterator converted to type, wrong scope check (#3433) 2021-08-31 09:48:23 +02:00
Paul Fultz II 4566e0e439
Fix 10148: False positive: knownConditionTrueFalse in for loop due to &= (#3425) 2021-08-28 09:28:29 +02:00
Paul Fultz II 740becbddf
Fix 10348: FP knownConditionTrueFalse with condition variable in do ... while loop (#3422) 2021-08-27 05:46:57 +02:00
Paul Fultz II 712ff1c073
Fix 10436: hang: valueFlowSubFunction 'ispunct(c)..' (#3423) 2021-08-27 05:46:33 +02:00
Paul Fultz II 1cd9d0479d
Fix 10433: assertion failure in ValueFlow (Interval::fromValues) (#3419) 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 (#3416) 2021-08-25 04:51:54 +02:00
Paul Fultz II 8ddc5764f8
Fix 10425: False positive: returnDanglingLifetime when taking address of captured variable (#3415) 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 (#3413) 2021-08-23 11:12:42 +02:00
Paul Fultz II 865163b2ba
Add library configurations for free functions like std::size, std::empty, etc (#3410) 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 (#3411) 2021-08-21 21:17:05 +02:00
Paul Fultz II d30f42e0da
Fix FP when calling a function in a condition (#3412) 2021-08-21 18:52:11 +02:00
Paul Fultz II e62cdbb664
Deduce symbolic values from conditions (#3406) 2021-08-19 22:01:55 +02:00
Paul Fultz II e0de48bb1d
Fix 7524: ValueFlow: false path for 'x<3' (#3393) 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 (#3402) 2021-08-15 08:02:31 +02:00
Paul Fultz II f81ddd2daa
Fix 10408: FP nullPointer on 'return x.release()' (#3404) 2021-08-15 07:43:50 +02:00
Paul Fultz II c92dab1329
Fix 10406: FP danglingLifetime with pointer-to-pointer (#3401) 2021-08-14 21:37:17 +02:00
Paul Fultz II b9ac48c90a
Fix 10409: FP 'Condition 's.size()<3' is always false' (#3396) 2021-08-14 06:48:38 +02:00
Paul Fultz II 69eaa9dfd9
Refactor: ConditionHandler cleanup (#3394) 2021-08-11 08:37:37 +02:00
Paul Fultz II 0f897acecd
Fix FP in solveExpr when using symbolic values (#3391) 2021-08-09 20:41:10 +02:00
Paul Fultz II a218ea3b23
Fix 10404: FP knownConditionTrueFalse after subtraction (#3390) 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