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
Paul
7776fb82a2
Fix issue 737: new check: Dereference end iterator
2020-08-17 16:36:45 -05:00
Paul
a509de4d70
Add moves
2020-08-11 11:50:27 -05:00
Paul
8c7e91c985
Remove old container forward
2020-08-10 22:09:33 -05:00
Paul
71c228a01a
Check for containers that modify the size using square bracket
2020-08-10 22:07:22 -05:00
Paul
a5b0a1c9e2
Evaluate container size in program memory
2020-08-10 20:08:49 -05:00
Paul
fec2914700
Add tests for container changes
2020-08-09 22:52:03 -05:00
Paul
26693df788
Use forward analyzer for container forward
2020-08-08 00:10:03 -05:00
Daniel Marjamäki
b263b93f73
Merge pull request #2732 from pfultz2/invalid-container-subobj
...
Fix issue 9780: FP: invalidContainer calling push_back after getting the address of the vector
2020-08-07 09:52:25 +02:00
Paul
56affc9080
Fix issue 9780: FP: invalidContainer calling push_back after getting the address of the vector
2020-08-06 21:08:30 -05:00
Paul
0cc1f69862
Fix issue 9770: FP returnDanglingLifetime for class method taking const char* and returning std::string
2020-08-05 23:17:35 -05:00
Daniel Marjamäki
fa32624c93
ValueFlow: Avoid UB in shift when rhs is negative
2020-07-25 14:13:21 +02:00
Ken-Patrick LEHRMANN
a923115710
Add missing operators <<= and >>=
...
This fixes issues (at least false positives) in code using them.
For instance:
```
unsigned compute(unsigned long long a) {
unsigned num = 0;
while (a > 0xFFFFFFFF) {
a >>= 32;
num += 32;
}
if (a > 0xFFFF) {
a >>= 16;
num += 16;
}
if (a > 0xFF) {
num += 8;
}
return num;
}
```
would give false positive:
```
cppcheck --enable=style sl3.cpp
Checking sl3.cpp ...
sl3.cpp:11:11: style: Condition 'a>0xFF' is always false [knownConditionTrueFalse]
if (a > 0xFF) {
^
sl3.cpp:3:14: note: Assuming that condition 'a>0xFFFFFFFF' is not redundant
while (a > 0xFFFFFFFF) {
^
sl3.cpp:11:11: note: Condition 'a>0xFF' is always false
if (a > 0xFF) {
^
```
2020-07-23 14:36:34 +02:00
Daniel Marjamäki
25ad22c6af
astyle formatting
...
[ci skip]
2020-07-23 10:09:06 +02:00
Daniel Marjamäki
df99d8aa0a
Merge pull request #2719 from pfultz2/fp-unreachable-alias
...
Fix issue 9807: False positive: ValueFlow in unreachable code, || lhs is true
2020-07-23 09:52:54 +02:00
Daniel Marjamäki
2fd44fa464
Merge pull request #2710 from pfultz2/fp-invalid-container-pointer
...
Fix issue 9796: False positive: lifetime, pointer item is not deallocated by pop_back
2020-07-22 09:24:54 +02:00
Paul
0def5d7a9a
Reduce variable scope
2020-07-21 19:09:58 -05:00
Paul
dbb410cdae
Merge branch 'main' into condition-in-expr
2020-07-21 13:28:59 -05:00
Paul
38e1b57bc9
Use refs
2020-07-21 13:18:45 -05:00
Paul
e2a81a382f
Track reading aliases during valueflow forward
2020-07-19 23:25:35 -05:00
Paul
831690f89b
Use parseDecl instead
2020-07-16 14:33:39 -05:00
Paul
423dcfd005
Fix issue 9796: False positive: lifetime, pointer item is not deallocated by pop_back
2020-07-15 12:22:36 -05:00
Daniel Marjamäki
1567ccf97b
Merge pull request #2700 from pfultz2/afterConditionFunction
...
Extend scope of afterCondition until end of function
2020-06-30 08:28:08 +02:00
Paul
67e06c18a9
Use the already available function scope
2020-06-29 15:36:01 -05:00
Daniel Marjamäki
f34ff9325a
Fixed testrunner
2020-06-29 21:53:14 +02:00
Daniel Marjamäki
a0770f05e1
Reuse 'extractForLoopValues' in ValueFlow
2020-06-29 21:01:43 +02:00
Paul
07d8cb4f01
Extend scope of afterCondition until end of function
2020-06-29 11:55:59 -05:00
Paul
d5b6d49d96
Fix issue 9578: false negative: (style) Condition '...' is always false
2020-06-28 15:28:08 -05:00
Ken-Patrick Lehrmann
5a3789a23f
9769: Improve value flow for ternary operator
...
In some cases, the condition of the ternary operator is assigned a known
value after the two possible results, and in such cases, we would not
take the opportunity to assign a value to the ternary operator (and to
the other parents in the ast).
This patch adds this capability.
2020-06-20 10:29:28 +02:00
Daniel Marjamäki
2b0e4926bc
valueFlowAfterAssign: variable initialization
2020-06-14 21:14:05 +02:00
Daniel Marjamäki
6600453b44
Try to make Travis happy
2020-06-13 07:45:31 +02:00
Paul Fultz II
3109d16b42
Fix issue 9742: FP iterators3 for address of reference to vector in struct ( #2668 )
2020-06-01 08:53:08 +02:00
Paul Fultz II
eb4754b7d9
Fix issue 9587: False positive: parameter can be declared with const ( #2667 )
2020-05-31 10:10:10 +02:00
Daniel Marjamäki
d64631219b
Fixed #9741 (Wrong value for sizeof)
2020-05-28 21:24:48 +02:00
Paul Fultz II
c9798590ba
Fix issue 9701: False positive. 3rd expression in for uses comma operator. ( #2664 )
2020-05-28 07:41:47 +02:00
Oliver Stöneberg
4f68d85633
optimized non-matchcompiled Token::simpleMatch() a bit ( #2640 )
2020-05-26 20:13:56 +02:00
Daniel Marjamäki
ff17cc2e8f
astyle formatting
...
[ci skip]
2020-05-24 10:52:58 +02:00
Paul Fultz II
bbe6157e16
Fix issue 9712: False positive: Returning pointer to local variable when return line implicitly cast to return type ( #2662 )
2020-05-23 23:12:00 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy ( #2633 )
2020-05-23 07:16:49 +02:00
Paul Fultz II
0832830a95
Fix issue 9721: ValueFlow: Comparison is always false, but ValueFlow says it is always true ( #2658 )
2020-05-23 07:15:13 +02:00
Daniel Marjamäki
4c5310433c
astyle formatting
...
[ci skip]
2020-05-22 08:48:28 +02:00
Paul Fultz II
8301fa8244
Fix issue 8144: valueFlowBeforeCondition: struct ( #2645 )
2020-05-21 08:47:48 +02:00
Ken-Patrick Lehrmann
a96a879b6d
Fix crash in addons/test/test-misra.py ( #2652 )
2020-05-20 16:02:13 +02:00