Commit Graph

858 Commits

Author SHA1 Message Date
Paul Fultz II 372161c89b
Fix issue 9939: False positive: Reference to temporary returned (static variable) (#2840) 2020-10-06 09:16:54 +02:00
Daniel Marjamäki 17e562a87f astyle formatting
[ci skip]
2020-10-03 11:02:11 +02:00
Paul 828a5e2326 Fix issue 9930: valueFlowLifetime hang 2020-10-03 11:01:53 +02:00
Paul Fultz II d9eacaecbb
Fix issue 9842: ValueFlow: wrong handling of ?, seems to think that the whole expression is a condition (#2821) 2020-09-23 07:45:03 +02:00
Oliver Stöneberg 7189b303ae
fixed some modernize-loop-convert clang-tidy warnings (#2815) 2020-09-21 19:30:47 +02:00
Paul Fultz II 857722f859
Fix issue 9711: FP knownConditionTrueFalse for variable modified via pointer (#2813) 2020-09-20 14:27:09 +02:00
Paul Fultz II c2e8051196
Fix issue 9904: False positive: duplicateCondition when modifying variable in lambda (#2811) 2020-09-18 07:44:26 +02:00
Paul Fultz II e5d0ffdbe7
Fix issue 9900: False positive: Returning lambda that captures local variable 'x' that will be invalid when returning. (#2809) 2020-09-17 08:33:52 +02:00
Paul Fultz II 11c99d7387
Fix issue 9880: False positive: danglingLifetime (#2810) 2020-09-17 07:23:38 +02:00
Paul Fultz II ebbff08932
Fix issue 9899: False positive: Non-local variable will use object that points to local variable (#2808) 2020-09-15 07:11:52 +02:00
Paul Fultz II bb7164171c
Fix issue 9894: ValueFlow: wrong known value below while with assignment (#2804)
* Fix issue 9894: ValueFlow: wrong known value below while with assignment
2020-09-14 08:03:25 +02:00
Daniel Marjamäki 600538a325
Merge pull request #2793 from Ken-Patrick/mixedoperators
Fix false positives with condition with || and &&
2020-09-11 10:11:31 +02:00
Daniel Marjamäki 92d65a1824 astyle formatting 2020-09-11 08:51:12 +02:00
Ken-Patrick Lehrmann a114bf0293 Fix false positives with condition with || and &&
The value of something in the middle of a condition with mixed || and &&
gives no information on which branch will be taken.
For instance with:
```
int f(int a, int b, bool x) {\n"
  if (a == 1 && (!(b == 2 && x))) {
  } else {
    if (x) {
    }
  }

  return 0;
}
```
We can enter the if part whether x is true or false, and similarly,
enter the else part whether x is true or false. Same thing with the
value of b.

This fixes the following false positive with above code:
```
:4:13: style: Condition 'x' is always true [knownConditionTrueFalse]
        if (x) {
            ^
:2:33: note: Assuming that condition 'x' is not redundant
    if (a == 6 && (!(b == 21 && x))) {
                                ^

```
2020-09-10 23:27:39 +02:00
Paul bb9dbaa8f5 Format 2020-09-09 21:32:07 -05:00
Paul 75b955b9c6 Fix issue 9833: False positive: Division by zero when using pointer to struct 2020-09-09 21:29:26 -05:00
Paul Fultz II 34d65e25d6
Merge branch 'main' into lifetime-subfunction 2020-09-09 12:02:02 -05:00
Daniel Marjamäki 687b44dbb7 Token: add flag for splitted variable declaration with initialization 2020-09-09 16:22:47 +02:00
Daniel Marjamäki b1401c6536
Merge pull request #2789 from pfultz2/smart-ptr-constructor
Fix issue 9496: False negative: Dereferencing returned smart null-pointer
2020-09-09 08:16:30 +02:00
Paul 965fea370f Formatting 2020-09-08 21:55:53 -05:00
Paul 382408f59e Fix issue 9496: False negative: Dereferencing returned smart null-pointer 2020-09-08 21:54:38 -05:00
Paul 8d7088aa24 Fix issue 9835: False negative: Return reference to temporary with const reference 2020-09-08 18:30:45 -05:00
Paul 8c425790f4 Merge branch 'main' into lifetime-subfunction 2020-09-08 13:18:01 -05:00
Daniel Marjamäki 18e99176e5
Fix issue 9883: endless recursion in getLifetimeTokens (#2786) 2020-09-08 20:14:54 +02:00
Paul Fultz II 5099ca3c8b
Fix issue 9882: segfault in ForwardTraversal (#2785) 2020-09-08 20:14:10 +02:00
Paul d5489fd1f0 Fix issue 9883: endless recursion in getLifetimeTokens 2020-09-08 11:33:29 -05:00
Paul 1be67ea008 Merge 2020-09-08 11:00:57 -05:00
Daniel Marjamäki 0c6dc84cbb astyle formatting
[ci skip]
2020-09-07 10:56:02 +02:00
Paul Fultz II 362ab44c40
Fix issue 9646: False negative: Return reference to temporary with const reference (#2782) 2020-09-07 10:52:54 +02:00
Daniel Marjamäki c7aed8bd0e astyle formatting 2020-09-06 07:47:17 +02:00
Daniel Marjamäki b0b31feadd fix ubsan errors 2020-09-05 21:09:11 +02:00
Daniel Marjamäki a102574e3f astyle formatting 2020-09-05 08:00:51 +02:00
Paul Fultz II cc2bc74084
Track lifetime for lambdas with explicit capture (#2776) 2020-09-05 07:56:01 +02:00
Paul bb37b07def Extend lifetimes to subfunctions 2020-09-04 11:56:34 -05:00
shaneasd 84dd0c961f
False positive dynamic_cast auto variable which has been checked against null (#2769) 2020-09-04 07:06:26 +02:00
Paul Fultz II 03cefd5d70
Fix issue 9853: False positive: returnReference when using a pointer to container (#2765) 2020-09-02 20:01:08 +02:00
Paul Fultz II 32df807b22
Fix issue 9783: wrong lifetime analysis temporary assigned to object (#2711) 2020-09-02 07:13:15 +02:00
Daniel Marjamäki 8e79b0c8bc astyle formatting
[ci skip]
2020-09-01 20:00:04 +02:00
Paul Fultz II ba84196dca
Fix issue 9865: false positive: knownConditionTrueFalse (#2764) 2020-09-01 11:22:38 +02:00
Paul Fultz II 1c5f496350
Fix issue 8373: false negative: invalid iterator (#2761) 2020-08-31 08:46:56 +02:00
Daniel Marjamäki 18c29544eb astyle formatting 2020-08-28 19:29:33 +02:00
Paul Fultz II 6ab3c93fb1
Fix issue 9756: false negative: invalid iterator from std::find_if (#2760) 2020-08-28 19:29:09 +02:00
Paul Fultz II 82bdbcd73b
Fix issue 9859: false positive: knownConditionTrueFalse (#2759) 2020-08-28 19:26:09 +02:00
Paul Fultz II 494fff65b7
Add outOfBounds check for iterators to containers (#2752) 2020-08-26 21:05:17 +02:00
Daniel Marjamäki bb5cad42cd astyle formatting
[ci skip]
2020-08-26 10:15:09 +02:00
Paul Fultz II ec89c57a90
Fix issue 9849: false positive: containerOutOfBounds (#2753) 2020-08-25 07:12:41 +02:00
Paul Fultz II 02287d9d34
Fix issue 7324: valueFlowForward : decrement (#2737) 2020-08-24 13:10:36 +02:00
Daniel Marjamäki 2bb73840fc astyle formatting 2020-08-23 17:17:33 +02:00
Paul Fultz II ac846b96d1
New check: Iterating a known empty container (#2740) 2020-08-22 09:16:26 +02:00
Daniel Marjamäki e0e70c2531 Fixed compiler warnings 2020-08-21 17:23:55 +02:00