Oliver Stöneberg
dae37f1c9f
disabled precompiled headers in CMake as they currently do not emit any compiler warnings / adjusted check for precompiled header ( #2820 )
2020-09-23 07:51:21 +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
Daniel Marjamäki
107ee57e7a
Fixed #9909 (False positive: knownArgument for calculation 'self->maxsize * sizeof(intptr_t)')
2020-09-21 20:02:55 +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
7b6d3f8061
Fix issue 9907: False positive: knownEmptyContainer after function call with :: ( #2814 )
2020-09-20 22:37:28 +02:00
Daniel Marjamäki
730b95331e
Fixed #9905 (False positive: known argument 'header.length()')
2020-09-20 20:17:10 +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
782684a7cc
Fix issue 9530: False positive: Reference to temporary returned when using initializer lists ( #2796 )
2020-09-17 08:33:16 +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
Daniel Marjamäki
3459f0da32
Fixed #9812 (False positive; syntax error 'using array_p = const array_t *;')
2020-09-14 21:59:58 +02:00
shaneasd
53a0760fdf
Improve ast generation for templated function parameters ( #2803 )
2020-09-14 18:44:50 +02:00
Paul Fultz II
a42976d656
Fix issue 9898: false positive: knownConditionTrueFalse ( #2806 )
2020-09-14 18:43:11 +02:00
Daniel Marjamäki
4dd85cfbe0
Merge pull request #2802 from rikardfalkeborn/9228-fix-fn-with-realloc-and-null-assignment
...
Improve memleakOnRealloc with assignment to NULL
2020-09-14 11:04:29 +02:00
Paul Fultz II
94850fec3f
Fix issue 9897: False positive: nullPointerRedundantCheck ( #2805 )
2020-09-14 09:17:29 +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
Rikard Falkeborn
791051ced0
Fix #9228 (FN common realloc mistake with assignment of NULL)
...
Do not match for assignments with NULL.
2020-09-13 21:49:49 +02:00
Rikard Falkeborn
da8ad9ce19
memleakOnRealloc: Don't warn if pointer is NULL in condition
2020-09-12 18:48:23 +02:00
Paul
be900873cc
FIx issue 9895: ValueFlow: Wrong known value below function call with reference parameter
2020-09-11 16:03:57 -05:00
Daniel Marjamäki
e03a8e1dc1
Fixed #9892 (Crash: endless recursion in Token::typeDecl for expression 'auto combo = widget->combo = new Combo{};')
2020-09-11 21:29:48 +02:00
Daniel Marjamäki
61145cf878
test/cli/test-inline-suppress.py: better testing
2020-09-11 18:29:42 +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
d46b9cec5f
Merge pull request #2795 from pfultz2/fp-lifetime-temp-function-obj
...
Fix issue 9889: False positive: Using reference to dangling temporary with function object
2020-09-11 09:05:43 +02:00
Daniel Marjamäki
7e02789d3f
Merge pull request #2794 from pfultz2/lifetime-temp-ref-move
...
Fix issue 9888: False positive: Using reference to dangling temporary with std::move
2020-09-11 07:20:32 +02:00
Daniel Marjamäki
ac66f67bad
Merge pull request #2790 from pfultz2/forward-analyze-accumulate-actions
...
Fix issue 9833: False positive: Division by zero when using pointer to struct
2020-09-11 07:17:10 +02:00
Paul
71bc79ac28
Fix issue 9889: False positive: Using reference to dangling temporary with function object
2020-09-10 22:58:17 -05:00
Paul
b26c581556
Fix issue 9888: False positive: Using reference to dangling temporary with std::move
2020-09-10 22:38:31 -05:00
Paul
4d1b3e06c7
Fix FPs
2020-09-10 17:06:49 -05: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
Daniel Marjamäki
2b12ef653d
Merge pull request #2792 from IOBYTE/main
...
fix #9886 (Hang in TemplateSimplifier (gcc/gcc/testsuite/g++.dg/cpp0x…
2020-09-10 21:47:44 +02:00
Daniel Marjamäki
51f5f2c7d0
Fix inline suppressions problem
2020-09-10 21:46:15 +02:00
Robert Reif
a52ce7379a
fix #9886 (Hang in TemplateSimplifier (gcc/gcc/testsuite/g++.dg/cpp0x/decltype34.C))
2020-09-10 14:47:59 -04:00
Paul
5033fb4418
Fix issue 9869: False positive: knownEmptyContainer when passed to constructor
2020-09-09 22:23:42 -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
7c8c0ef3a2
Bug hunting: Avoid uninit struct member false positives
2020-09-09 18:26:04 +02:00
Daniel Marjamäki
f95a53b0ca
Fixed #9821 (False positive: Delegating constructor and initialization list)
2020-09-09 18:04:21 +02:00
Paul Fultz II
bfe53fce04
Fix issue 9878: false positive: multiCondition ( #2787 )
2020-09-09 15:39:36 +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
Daniel Marjamäki
1c37423f1b
Merge pull request #2788 from pfultz2/lifetime-dangling-temp-reference
...
Fix issue 9835: False negative: Return reference to temporary with const reference
2020-09-09 08:01:22 +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
Daniel Marjamäki
5376decbe7
Merge pull request #2783 from pfultz2/out-of-bounds-at-index
2020-09-08 20:30:31 +02: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
e802d85315
Fixed #9445 (Syntax error on typeof word in C)
2020-09-08 17:12:54 +02:00
Daniel Marjamäki
c0ef640304
Fixed #9881 ((Regression) Hang with operator() in function call)
2020-09-07 21:32:29 +02:00
Daniel Marjamäki
07f6876dc8
Bug hunting; avoid uninit var fp for struct variables
2020-09-07 21:19:07 +02:00
Daniel Marjamäki
cfd41fea83
Fixed #9879 (Tokenizer: Better handling of operator() '(*this)(...)')
2020-09-07 20:07:21 +02:00
IOBYTE
2106e30304
fix template namespace bug ( #2780 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2020-09-07 17:45:19 +02:00
Daniel Marjamäki
acfff072ae
Bug hunting; avoid bughuntingUninitVar fp for template variable
2020-09-07 16:25:37 +02:00
Paul Fultz II
ac67049661
Fix issue 9858: Token::astOperand1() cyclic dependency on valid C++ code ( #2784 )
2020-09-07 10:54:32 +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
06c4b8897b
Bug hunting: Avoid uninitialized fp for smart pointer
2020-09-07 09:34:08 +02:00
Paul Fultz II
a4f43fc2ad
Fix issue 8234: false negative: (warning) Opposite inner 'if' condition leads to a dead code block. ( #2781 )
2020-09-07 07:53:41 +02:00
Paul
7754449fd6
Format
2020-09-06 23:48:05 -05:00
Paul
04c85baf03
Fix issue 8869: false negative: (error) Invalid v.at() argument nr 1
2020-09-06 23:46:31 -05:00
Paul
786672e19d
Format
2020-09-06 21:59:21 -05:00
Paul
c7a5d3c5f1
Fix FPs
2020-09-06 21:58:36 -05:00
Daniel Marjamäki
136ac2c643
Fixed #9266 (handle operator() better)
2020-09-06 21:02:06 +02:00
Daniel Marjamäki
4bf411d63d
ImportProject: Add test case
2020-09-06 16:08:42 +02:00
Daniel Marjamäki
54b5e77548
TestImportProject: Use raw strings
2020-09-06 16:00:19 +02:00
Dan
7efd84ecaf
Fix false skipping of folder-seperator ( #2749 )
2020-09-06 15:35:14 +02:00
shaneasd
9712c136bd
make result of <<|>> an xvalue ( #2775 )
2020-09-05 12:07:06 +02:00
Paul Fultz II
cc2bc74084
Track lifetime for lambdas with explicit capture ( #2776 )
2020-09-05 07:56:01 +02:00
Daniel Marjamäki
8027f40418
Fixed #8506 (CPPCheck printing invalid characters in output)
2020-09-04 20:43:54 +02:00
Daniel Marjamäki
1daf1ec108
Fixed #9875 (Crash)
2020-09-04 19:15:48 +02:00
Paul
264c0cae8b
Formatting
2020-09-04 11:59:30 -05:00
Paul
bb37b07def
Extend lifetimes to subfunctions
2020-09-04 11:56:34 -05:00
Daniel Marjamäki
30d3643bb8
Fixed #9851 (FP virtualDestructor - private virtual dtor)
2020-09-04 18:56:12 +02:00
Daniel Marjamäki
040da4ff32
astyle formatting
2020-09-04 18:43:17 +02:00
Daniel Marjamäki
7d01ad5b50
add test-clang-import that compares symboldatabases
2020-09-04 15:29:19 +02:00
IOBYTE
2db0d2878b
fix daca crash in TemplateSimplifier::getNewName ( #2772 )
...
Don't add the same template instantiation multiple times.
Co-authored-by: Robert Reif <reif@FX6840>
2020-09-04 07:08:28 +02:00
shaneasd
84dd0c961f
False positive dynamic_cast auto variable which has been checked against null ( #2769 )
2020-09-04 07:06:26 +02:00
Daniel Marjamäki
dba7108832
Remove test-clang-import for now so I can fix that
2020-09-03 21:43:26 +02:00
Daniel Marjamäki
1ce6eb34fb
test-clang-import: try to use --std=c++11
2020-09-03 21:13:08 +02:00
Daniel Marjamäki
c4da64b38b
Fix test-clang-import
2020-09-03 20:19:33 +02:00
Daniel Marjamäki
b3d7289460
test-clang-import: Only run tests if clang is in PATH
2020-09-03 20:18:33 +02:00
Daniel Marjamäki
5cd92a0eb1
test/cli/test-clang-import: Improved testing
2020-09-03 19:49:02 +02:00
Daniel Marjamäki
115ad374ba
test-clang-import.py: make it python2 compatible
2020-09-03 19:04:42 +02:00
Daniel Marjamäki
5acd6fcdc8
astyle formatting
2020-09-03 18:55:40 +02:00
shaneasd
08ea6435ac
fix false positives in constParameter ( #2758 )
2020-09-03 18:44:44 +02:00
Daniel Marjamäki
68ec7dad41
Add clang import test
2020-09-03 18:39:46 +02:00
Daniel Marjamäki
3fe46239cf
SymbolDatabase; Refactoring, use Tokenizer::isFunctionHead to skip function attributes
2020-09-03 11:21:12 +02:00
Dan
974b6fb8e5
Add test cases for assign operators with default implementation ( #2767 )
2020-09-03 07:29:54 +02:00
Paul Fultz II
090eba7e7f
FIx issue 6140: ValueFlow: valueFlowForward, loop ( #2770 )
2020-09-03 07:17:36 +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
Daniel Marjamäki
12d51ae5c4
Fixed #9809 (Tokenizer; Fix handling of variable declaration with @)
2020-09-02 13:04:33 +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
Paul Fultz II
dea5a23c34
Improve check: check for known empty containers passed to algorithms ( #2768 )
2020-09-02 07:11:23 +02:00
Daniel Marjamäki
8e79b0c8bc
astyle formatting
...
[ci skip]
2020-09-01 20:00:04 +02:00
Daniel Marjamäki
1f8896e51c
clang import: try to handle CXXFunctionalCastExpr
2020-09-01 19:59:41 +02:00
Paul Fultz II
ba84196dca
Fix issue 9865: false positive: knownConditionTrueFalse ( #2764 )
2020-09-01 11:22:38 +02:00
Paul Fultz II
0a718694af
Fix issue 9852: False positive: danglingTemporaryLifetime when returning a vector of vectors ( #2766 )
2020-09-01 11:21:29 +02:00
Paul Fultz II
3e99bff764
Same expression when comparing with zero ( #2762 )
2020-08-31 08:48:48 +02:00
Paul Fultz II
1c5f496350
Fix issue 8373: false negative: invalid iterator ( #2761 )
2020-08-31 08:46:56 +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
IOBYTE
8774e97f26
fix #9771 (Syntax error; operator != <> ()) ( #2757 )
2020-08-26 18:39:33 +02:00
Daniel Marjamäki
bb5cad42cd
astyle formatting
...
[ci skip]
2020-08-26 10:15:09 +02:00
Paul Fultz II
9ec27c112f
Fix issue 9855: false positive: uninitvar ( #2754 )
2020-08-26 07:02:15 +02:00
IOBYTE
7cf3909275
fix #9854 (Syntax error on valid C++ code) ( #2756 )
2020-08-26 07:00:58 +02:00
Paul Fultz II
46bf2d7d52
Dont diagnose impossible values for iterators ( #2755 )
2020-08-26 06:58:53 +02:00
shaneasd
45fc6a0eeb
Test for syntax error in nested templates ( #2746 )
2020-08-25 07:14:44 +02:00
Paul Fultz II
ec89c57a90
Fix issue 9849: false positive: containerOutOfBounds ( #2753 )
2020-08-25 07:12:41 +02:00
Daniel Marjamäki
6277eece67
Variable contracts
2020-08-24 20:57:49 +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
eivindt
27e40af06c
Add support for comments at end of suppression in suppression files ( #2736 )
2020-08-20 21:49:07 +02:00
Paul Fultz II
a332062385
Add exprId to tokens ( #2744 )
2020-08-20 18:21:29 +02:00
Daniel Marjamäki
6446790d48
Merge pull request #2739 from dan-42/fix_ticket_9839_ast_error
...
Fix ticket 9839: AST broken; range for loop that uses decltype
2020-08-18 21:59:50 +02:00
Paul
7776fb82a2
Fix issue 737: new check: Dereference end iterator
2020-08-17 16:36:45 -05:00
Daniel Friedrich
160b8f0f17
Add test case to reproduce bug
...
Add tokenizer test range based for with decltyle(x) *
2020-08-17 20:51:45 +02: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
Daniel Marjamäki
5372e93964
Fixed #9825 (redundantAssignment: Do not warn about volatile data)
2020-08-06 22:18:25 +02: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
d5b64d9c3a
Clarify inconclusive uninitMemberVar warning in copy constructors, it's in general a good idea to copy all the data.
2020-08-05 13:57:40 +02:00
Daniel Marjamäki
7a85b8e452
Do not ask that calculation is clarified when different order would be invalid
2020-08-05 13:20:18 +02:00
Jens Yllman
5ba5916a11
clearer name on the test
2020-08-03 10:30:21 +02:00
Jens Yllman
1cc16deba3
test added to show it works after fix
2020-07-30 22:22:54 +02:00
Daniel Marjamäki
fab3a8efc8
Merge pull request #2721 from KenPatrickLehrmann/compound_assign_bitshift
...
Add missing operators <<= and >>=
2020-07-25 09:39:32 +02:00
Daniel Marjamäki
6a839ad511
Fixed #9814 (False positive: functionConst, trailing return type)
2020-07-24 19:40:42 +02:00
Paul
46e008c3e2
Fixed #9816 (False positive: Condition '!b' is always false in nested do-while loop)
2020-07-24 08:13:14 +02:00
Daniel Marjamäki
53e11ead8f
Fix Cppcheck warning: unused variable in test
2020-07-23 19:50:41 +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
682a6d1c02
Fixed #9017 (Simple classes without side effects not reported as unused)
2020-07-23 11:10:08 +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
abeea7b32b
Merge branch 'main' into fp-invalid-container-pointer
2020-07-21 13:31:13 -05:00
Paul
dbb410cdae
Merge branch 'main' into condition-in-expr
2020-07-21 13:28:59 -05:00
Rikard Falkeborn
7973fd843c
Refactor: Simplify checkSignConversion
...
The loop only checks astoperand1 and astoperand2. Simplify the condition
to loop over these instead of using a stack. Also, add a testcase for
when astoperand2 is negative.
2020-07-20 11:16:56 +02:00
Paul
e2a81a382f
Track reading aliases during valueflow forward
2020-07-19 23:25:35 -05:00
Daniel Marjamäki
4a76dbb632
Bug hunting; Avoid bailout uninit FP, stream object
2020-07-19 16:54:44 +02:00
Daniel Marjamäki
7e65b561f0
AST: Fix ast for 'for ((..initexpr..);;)'
2020-07-19 11:10:38 +02:00
Daniel Marjamäki
e9281babc4
Bug hunting; avoid false positives for structs/classes with constructors
2020-07-18 18:54:21 +02:00
Georgy Komarov
382f21a5c9
Fixed crash on garbage code: comparisson with an empty second operand
...
This will fix #9774 .
2020-07-18 07:02:12 +03:00
Paul
831690f89b
Use parseDecl instead
2020-07-16 14:33:39 -05:00
Daniel Marjamäki
47ff29f1c8
Merge pull request #2708 from pfultz2/multi-mutex-lock
...
Handle FPs: mutexes being locked at different scopes
2020-07-16 08:35:05 +02: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
af0db3cc21
Add cppcheck-id for warnings. To start with it's a simple id that changes when file is changed.
2020-07-14 22:30:42 +02:00
Paul
1f74400f13
Merge branch 'revert-mutex-delete' into multi-mutex-lock
2020-07-14 13:05:14 -05:00
Paul
4373404238
Revert "Fixed #9795 (False positive: Local lock is not ineffective, mutex is locked in thread also.)"
...
This reverts commit 27841d6b81
.
2020-07-14 13:04:59 -05:00
Daniel Marjamäki
e0be224f4e
Merge pull request #2709 from pfultz2/fp-duplicate-cond-this
...
Fix FP of duplicateCondition when modifying the this variable
2020-07-13 21:14:58 +02:00
Daniel Marjamäki
b2f463dd65
Merge pull request #2707 from Ken-Patrick/fp_pointer_expressions
...
Fix some false positives when the same expression at different places…
2020-07-13 20:59:22 +02:00
Paul
519f2a537a
Format
2020-07-13 13:55:45 -05:00
Daniel Marjamäki
33557012a1
Merge pull request #2706 from rikardfalkeborn/condition-fn-with-sizeof
...
Fix FN with known condition and sizeof
2020-07-13 20:54:25 +02:00
Daniel Marjamäki
cb221e970d
Bug hunting: Add test case for CVE-2019-12977. Passing uninitialized struct to function
2020-07-13 20:42:53 +02:00
Daniel Marjamäki
8ba714373f
Merge pull request #2704 from rikardfalkeborn/9635-memleak-with-comma-operator-in-if-statement
...
Fix #9635 (FP: Memory leak with comma operator in if-statement)
2020-07-13 20:08:57 +02:00
Paul
450bdfedf3
Fix FP of duplicateCondition when modifying the this variable
2020-07-13 12:40:01 -05:00
Daniel Marjamäki
4465d033f6
Bug hunting; When passing uninitialized data to unknown function it is inconclusive if that would be a problem for the function or not
2020-07-13 11:43:11 +02:00
Daniel Marjamäki
0009b4c8af
test/bug-hunting/cve.py: Add --slow argument to check slow packages
2020-07-13 11:18:51 +02:00
Paul
caabe56f14
Handle FPs: mutexes being locked at different scopes
2020-07-12 21:31:53 -05:00
Ken-Patrick Lehrmann
61ccf888b3
Fix some false positives when the same expression at different places does not have the same value
...
Typically with
```
int F(int *f);
void F2(int *a, int *b) {
int c = *a;
F(a); // modifies *a
if (b && c != *a) {}
}
```
we would get the following FP:
```
[test.cpp:3] -> [test.cpp:5]: (style) The comparison 'c != *a' is always false because 'c' and '*a' represent the same value.\n
```
I guess it boils down to isSameExpression only checking that the
expression is the same (in the above case, "*a" and "*a" are indeed the
same), but there's not real check on the values.
So the patch here is a bit hackish, and we still have false negatives in
cases with dereferenced pointers.
2020-07-11 14:13:18 +02:00
Rikard Falkeborn
d8e7e9176b
Fix FN with known condition and sizeof
...
cppcheck behaved differently if sizeof was to the left or right of the
comparison. In order to fix this, we cannot break the while loop until
all operands have been processed.
2020-07-10 23:39:16 +02:00
Daniel Marjamäki
27841d6b81
Fixed #9795 (False positive: Local lock is not ineffective, mutex is locked in thread also.)
2020-07-10 19:24:45 +02:00
Rikard Falkeborn
1e679cc5d1
Fix #9635 (FP: Memory leak with comma operator in if-statement)
...
When checking for comparisons in if-statements, if there are comma
operators in the if-statement, skip until after the last comma.
2020-07-09 21:31:43 +02:00
Daniel Marjamäki
0c6aabe444
Merge pull request #2703 from rikardfalkeborn/9652-fp-function-call-cast-config
...
Fix #9652 (fp memleak with function call with cast)
2020-07-08 15:10:41 +02:00
Rikard Falkeborn
4996ec190e
Fix #9652 (fp memleak with function call with cast)
...
When the first argument was (void *)(1), at the start of the second
iteration, arg was pointing to the "1", which caused problems for
nextArgument(), which saw the ")" as the next token and returned
nullptr, signalling that there are no more arguments.
Instead, save the first token in the argument, which makes
nextArgument() do the right thing.
2020-07-08 00:02:39 +02:00
Rikard Falkeborn
d5345052ab
Fix #9793 (false positive, memleak with lambda)
...
Skip scopes with lambdas (similar to how checkleakautovar does). In
order to fix this when the lambda is inside a for loop, make
hasInlineOrLambdaFunction() recursive. This should be what all existing
users want.
2020-07-07 21:51:36 +02:00
Daniel Marjamäki
921997c9e9
itc.py; false negative is fixed
2020-07-03 17:50:56 +02:00
orbitcowboy
cabafca5ae
windows.cfg: Added some constants from WinUser.h
2020-07-01 16:14:59 +02:00
Daniel Marjamäki
d2b2bae7bf
Fixed #7733 (False positive: scope of the variable can be reduced (variable is used in hidden code))
2020-07-01 08:24:52 +02:00
Daniel Marjamäki
f56a17bf3d
Fixed #8858 (FP: identicalConditionAfterEarlyExit when there is #if)
2020-07-01 07:48:32 +02:00
Daniel Marjamäki
0583763cc6
Fixed #3088 (False positive: Dont report "struct or union member is never used" for structs with __attribute__((packed)) or #pragma pack(push))
2020-06-30 11:00:40 +02:00
Paul
07d8cb4f01
Extend scope of afterCondition until end of function
2020-06-29 11:55:59 -05:00
Paul
edcf668ae2
Update test mesg
2020-06-29 10:15:36 -05:00
Daniel Marjamäki
a49d277e0d
Fixed #6471 (FP functionConst - member function modifying member variable after cast (inconclusive))
2020-06-29 13:09:01 +02:00
Paul
d5b6d49d96
Fix issue 9578: false negative: (style) Condition '...' is always false
2020-06-28 15:28:08 -05:00
Daniel Marjamäki
ad5e4fef1f
Bug hunting; improved handling of 'malloc' in uninit checker
2020-06-28 21:20:59 +02:00
Daniel Marjamäki
6c588cc3ef
Library: Refactoring <alloc> init attribute
2020-06-28 21:01:43 +02:00
Daniel Marjamäki
d4bd3016da
ExprEngine; Improved handling of for loop, loop variable
2020-06-28 17:28:40 +02:00
Daniel Marjamäki
c42c751d61
ExprEngine; Fixed testing
2020-06-28 13:41:27 +02:00
Daniel Marjamäki
e1704f2b50
Bug hunting; fix juliet test cases error id
2020-06-28 08:16:46 +02:00
Daniel Marjamäki
bcaf792e30
Bug hunting; Fix FP for struct with uninitialized members passed to function in C
2020-06-27 22:11:12 +02:00
Daniel Marjamäki
d353a4ecba
ExprEngine; copy Data => copy arrays
2020-06-27 18:09:43 +02:00
Daniel Marjamäki
e6aa96d90f
Bug hunting; Improved uninit checking
2020-06-27 14:59:02 +02:00
Daniel Marjamäki
e19ef6ac62
Bug hunting; Improved uninit checking for function calls with constant parameter
2020-06-27 14:15:53 +02:00
Daniel Marjamäki
ff5a717fc6
Bug hunting; Avoid false positives for const parameter data
2020-06-27 12:17:11 +02:00
Daniel Marjamäki
b09bcdc38c
Use ValueFlow for compareBoolExpressionWithInt
2020-06-27 08:13:22 +02:00
Daniel Marjamäki
1ad70bbeb8
Merge pull request #2697 from pfultz2/unique_lock
...
Extend mutex checking for more locking patterns
2020-06-27 07:32:26 +02:00
Daniel Marjamäki
c3749625f3
Merge pull request #2688 from jpyllman/fix_chklibfunc
...
not report locally declared functions as missing configuration of --check-library
2020-06-27 06:53:09 +02:00
Daniel Marjamäki
72bdeb9307
Merge pull request #2698 from pfultz2/const-param-casts
...
Fix issue 9778: False positive: constParameter when returning non-const reference cast
2020-06-27 06:45:30 +02:00
Paul
cf475fab51
Fix issue 9778: False positive: constParameter when returning non-const reference cast
2020-06-26 15:47:59 -05:00
Daniel Marjamäki
f5ace9ffbe
SymbolDatabase; Improved ValueType when container methods items
2020-06-26 22:47:28 +02:00
Paul
82b91869ee
Extend mutex checking for more locking patterns
2020-06-26 15:06:20 -05:00
orbitcowboy
b33326bf51
windows.cfg: Added a regression test for GetSystemInfo that ensure no uninitvar-FP is shown.
2020-06-26 20:45:18 +02:00