Rikard Falkeborn
8537331ad6
AutovarDeallocation: Fix grammar in error message ( #3654 )
2021-12-23 20:09:55 +01:00
Paul Fultz II
d36aa590cd
Fix 10553: FP uninitvar with strcpy ( #3652 )
2021-12-23 08:22:41 +01:00
Daniel Marjamäki
e6ccf299b9
Fixed #10598 (SymbolDatabase: final class is not parsed properly)
2021-12-22 21:48:01 +01:00
Chris Lalancette
df1d6cf026
Fix the ability to recognize return types when simplifying attributes. ( #3637 )
...
* Fix the ability to recognize return types when simplifying attributes.
When parsing attributes to remove them, we have to allow for
the case where the return type of the function that follows
the attribute has a namespaced C++ type, like foo::bar .
That means that :: has to be recognized as a valid token.
Fix this in simplifyAttribute, and add tests for this as well.
2021-12-22 19:02:38 +01:00
chrchr-github
ca4e5ac527
Fix #7038 false negative for string argument in the CheckIO ( #3649 )
2021-12-20 17:22:39 +01:00
Oliver Stöneberg
38de9214a8
small CheckStl optimization ( #3645 )
2021-12-20 07:29:45 +01:00
Paul Fultz II
73f24b43f9
Fix 10437: FP knownConditionTrueFalse after pointer check ( #3646 )
2021-12-20 07:28:40 +01:00
Daniel Marjamäki
0d7a3a8b26
dump; add 'noreturn' attribute for function calls
2021-12-19 15:32:33 +01:00
Paul Fultz II
d69257e8cd
Fix 9740: FP accessMoved related to designated initialization ( #3644 )
2021-12-19 12:36:48 +01:00
Oliver Stöneberg
cc24d6fcef
Fix #9162 (Invalid --project files do not give any error) ( #3177 )
2021-12-19 12:36:11 +01:00
chrchr-github
bb327be8e8
Fix #10591 FP unusedStructMember with value-initialized struct and typedef ( #3643 )
2021-12-18 22:55:52 +01:00
chrchr-github
8df25ec4e9
Fix #8266 identicalConditionAfterEarlyExit variable modified in if-clause ( #3610 )
2021-12-18 22:52:54 +01:00
Paul Fultz II
332f4c205a
Fix 9772: FP uninitvar: in cppcheck 2.1 ( #3638 )
2021-12-17 21:51:47 +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
Paul Fultz II
ac4f4258a0
Fix 10651: Crash on static template method ( #3633 )
2021-12-16 22:32:44 +01:00
chrchr-github
e8260f2dcc
Improve fix for #9570 : check if ternary operator is used in assignment to reference ( #3614 )
2021-12-16 22:32:15 +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
16110b6157
Fix 10339: Lambda in leads to analysis fail ( #3629 )
2021-12-15 19:34:18 +01:00
Paul Fultz II
5f73af0d0e
Fix 10625: False positive: known value below do while ( #3623 )
2021-12-15 19:32:14 +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
Daniel Marjamäki
d2dd4e54b9
Fix execution of executable addons from GUI
2021-12-15 19:27:02 +01:00
chrchr-github
532477cdb2
Fix #9549 FP knownConditionTrueFalse (bitshift) ( #3616 )
2021-12-14 07:30:57 +01:00
Paul Fultz II
cb2738a60c
Fix 10645: FP knownEmptyContainer after conditional return ( #3620 )
2021-12-14 07:22:57 +01:00
Daniel Marjamäki
77434d093e
SymbolDatabase: Do not set wrong type for std::map etc items in range for loop
2021-12-11 15:16:54 +01:00
Oliver Stöneberg
54b54567cf
astutils.cpp: optimized isSameExpression() a bit - reduces average Ir from 294 to 213 when analyzing test folder ( #3528 )
2021-12-11 15:10:15 +01:00
Daniel Marjamäki
d0e68e0d77
misra; add rule 17.3
2021-12-11 12:42:15 +01:00
chrchr-github
f64097465f
Fix #9342 FP oppositeExpression - negated value is not opposite for bitwise logical operators ( #3615 )
2021-12-10 18:06:45 +01:00
Rikard Falkeborn
e7b6920cf4
Fix #10600 : FP invalid dealloc of function array argument ( #3613 )
...
Do not warn for array arguments that are free'd, since they decay to
pointers.
2021-12-09 07:16:40 +01:00
chrchr-github
33c55f77a8
Fix #9570 ( #3608 )
2021-12-07 07:44:07 +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
0be6e27231
Fix 10640: FN nullPointerRedundantCheck ( #3607 )
...
* Fix 10640: FN nullPointerRedundantCheck
* Format
2021-12-06 20:06:48 +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
Rikard Falkeborn
1a50146745
autovarInvalidDeallocation: Fix fp with impossible value ( #3604 )
...
daca reports new false positives after db4f94fdfe
on the form:
void f() {
char *ptr = malloc(10);
char *empty_str = "";
if (ptr == NULL)
ptr = empty_str;
if (ptr != empty_str)
free(ptr);
}
Add a check that the value is not impossible to avoid this.
2021-12-05 15:47:21 +01:00
Paul Fultz II
f64bcac004
Fix 10429: Regression: invalidIterator ( #3603 )
2021-12-05 15:46:52 +01:00
Paul Fultz II
c0af66bb52
Fix 10552: Internal error with unusedFunction ( #3600 )
2021-12-05 15:46:17 +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
29dbded4af
Fix 10615: Crash in Token::linkAt ( #3599 )
2021-12-04 12:57:59 +01:00
Paul Fultz II
bc31419da0
Fix 9301: Syntax error when specializing template variable array ( #3601 )
2021-12-04 12:56:25 +01:00
Paul Fultz II
8dcea26c10
Find iterator mismatch when using temporary containers ( #3579 )
2021-12-04 12:55:56 +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
chrchr-github
4a1a1534df
Fix #10632 (FN charset in format string) ( #3590 )
...
* Fix #10632
* Typo
2021-12-01 09:51:48 +01:00
Rikard Falkeborn
db4f94fdfe
Fix #7341 : Dealloc string literal ( #3586 )
2021-11-30 07:31:28 +01:00
chrchr-github
d565cde815
Fix and tests for #7622 , #10381 , #10382 ( #3588 )
...
* Add test cases for #10381 , #10382
* Fix #7622
* Format
2021-11-29 22:51:35 +01:00
Daniel Marjamäki
396a69a630
Clang: do not silently abort from checks
2021-11-29 20:09:39 +01:00
Paul Fultz II
853a1f6d54
Fix 10631: FP, Regression: error: Return value of allocation function 'makeThing' is not stored. ( #3585 )
2021-11-29 07:06:43 +01:00
Daniel Marjamäki
c26e205e29
clang import: fixed problem with nameless struct
2021-11-29 07:00:18 +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
chrchr-github
cea649761c
Fix FN buffer overrun with array of pointers ( #3582 )
2021-11-27 12:15:36 +01:00
Paul Fultz II
1e327dfbd3
Fix 9836: False negative: No invalidContainer when using vector of vectors ( #3580 )
...
* Fix 9836: False negative: No invalidContainer when using vector of vectors
* Format
2021-11-26 13:38:40 +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
Rikard Falkeborn
085d25f1b1
SymbolDatabase: Fix valuetype with constexpr and auto ( #3577 )
2021-11-24 16:51:40 +01:00
Leon De Andrade
5b52f4946a
Implement support for passing multiple file filters ( #3479 )
2021-11-23 22:51:45 +01:00
Paul Fultz II
b80e24231b
Fix 10604: FP mismatchingContainerIterator with container member ( #3575 )
2021-11-23 22:50:32 +01:00
Daniel Marjamäki
c7ef602cd6
Fixed #9759 (False positive: constParameter on parameter used by non-const call via pointer to member function)
2021-11-21 20:03:38 +01:00
Daniel Marjamäki
10109a5ef7
dumpfile: remove redundant Variable attributes isArgument and isLocal. Add isVolatile.
2021-11-19 17:21:27 +01:00
Daniel Marjamäki
f701a9361d
chmod; Use 644 for source files
2021-11-17 08:25:25 +01:00
Daniel Marjamäki
8b5865055a
SymbolDatabase: Fix Variable pointer property for 'std::string x(*p)'
2021-11-17 08:22:49 +01:00
Paul Fultz II
8bff45281d
Fix 10599: regression- segmentation fault on template code ( #3565 )
2021-11-16 06:49:13 +01:00
Stefan van Kessel
5770110377
Fixed #10432 (Only the first default argument was copied from the forward declaration;) ( #3530 )
...
Co-authored-by: Stefan van Kessel <stefan.vankessel@muehlbauer.de>
2021-11-15 20:37:46 +01:00
chrchr-github
2bf7294d5b
Fix member shadowing ( #3563 )
2021-11-15 20:37:08 +01:00
chrchr-github
9c31e0ce54
Fix #10393 FP returnDanglingLifetime ( #3562 )
2021-11-15 20:36:38 +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
13f5b560ce
Fix 10555: FP knownConditionTrueFalse with non-const function in base class ( #3559 )
2021-11-12 20:05:43 +01:00
Paul Fultz II
771188238c
Fix 10574: ValueFlow: conditional values in constructor initializer list ( #3556 )
2021-11-11 08:01:10 +01:00
Paul Fultz II
c057dcce0f
Fix 10592: False positive: returnDanglingLifetime ( #3557 )
2021-11-11 08:00:05 +01:00
nomick
5865b05703
fix false positive of virtual function call ( #3553 )
2021-11-11 07:53:30 +01:00
chrchr-github
629f883408
Fix #10097 : autovarInvalidDeallocation with pointer to std::array ( #3529 )
2021-11-08 20:31:16 +01:00
Paul Fultz II
662ada6930
Refactor: Use a template instead of std::function in forward analyzer to help improve debugging ( #3551 )
2021-11-08 07:46:52 +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
a50596df72
Fix 10582: ValueFlow; wrong known value ( #3550 )
2021-11-07 06:51:51 +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
KenPatrickLehrmann
f5f600bafc
Don't simplify template for class names in declarations ( #3505 )
...
* Don't simplify template for class names in declarations
Without the patch, the test would give:
```
Expected:
namespace foo { class Bar ; } class Baz ; class C : Baz { } ;
Actual:
namespace foo { class Bar ; } class Baz ; class foo :: Bar : Baz { } ;
```
* Use valid code in test case
2021-11-06 19:07:45 +01:00
Paul Fultz II
ffc2a9d8e2
Fix 9735 for valueFlowUninit ( #3538 )
2021-11-06 19:06:07 +01:00
Daniel Marjamäki
9d1ec2638d
fix clang-tidy warning, different argument name for declaration and implementation
2021-11-05 21:07:18 +01:00
Daniel Marjamäki
ed4d2c21e6
Load cppcheck.cfg in FILESDIR if that is specified
2021-11-05 20:37:48 +01:00
Paul Fultz II
b835744a81
Fix 10585: FP danglingTemporaryLifetime recent regression ( #3544 )
...
Fix 10585: FP danglingTemporaryLifetime recent regression
2021-11-04 09:24:24 +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
7d7584b456
Fix 10575: Improve check; lifetime, struct member points to local data ( #3541 )
2021-11-01 19:22:21 +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
Daniel Marjamäki
3e6540c4b3
Fixed #10523 (FP: missingReturn with nested switch statements)
2021-10-31 14:48:29 +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
Daniel Marjamäki
3f7093004a
Fixed #10485 (FP unusedStructMember for array size)
2021-10-30 19:34:46 +02:00
Oliver Stöneberg
61a2b89034
streamlined message/error printing of CmdLineParser ( #3524 )
...
* cmdlineparser.cpp: removed message about deprecated --std=posix
* streamlined message/error printing of CmdLineParser
* test-helloworld.py: adjusted expected test result
2021-10-30 13:30:48 +02:00
Oliver Stöneberg
b4704ba065
use target-specific configuration instead of global ones in CMake ( #3534 )
2021-10-30 09:08:07 +02:00
Paul Fultz II
e998cd13ca
Partial fix for 10393: FP returnDanglingLifetime when constructing string from iterators [inconclusive] ( #3536 )
2021-10-30 09:06:36 +02:00
Paul Fultz II
e20ddd55d6
Propagate partially uninit variables in ValueFlow ( #3533 )
2021-10-30 07:43:37 +02:00
Daniel Marjamäki
b872639e31
fix klocwork warning; pointer is checked and then dereferenced. FN ticket: #10570
2021-10-29 19:23:01 +02:00
Daniel Marjamäki
87d1ba4c08
klocwork; fixed dereference before check. FN ticket: #10574
2021-10-28 17:20:45 +02:00
Daniel Marjamäki
d50e771a38
klocwork; fix uninitialized struct member. FN ticket: #10573
2021-10-28 17:09:33 +02:00