Commit Graph

617 Commits

Author SHA1 Message Date
chrchr-github 4654b6561b
Fix #11890 FP uninitvar for address taken in init list (#5360) 2023-08-24 10:35:33 +02:00
Paul Fultz II 52081ef08f
Add special function to match lifetimes (#5320)
This also removes the termination checking in `valueFlowUninit` as this
causes a lot of FNs.
2023-08-14 10:27:00 +02:00
chrchr-github d4d77edeae
Fix FP uninitStructMember / cleanup from #5311 (#5315) 2023-08-12 23:46:31 +02:00
chrchr-github 720ae01898
Fix #11353 FP uninitvar for struct member set via pointer (#5314) 2023-08-11 18:46:51 +02:00
chrchr-github a7d487f6db
Fix #11805 FP uninitvar for stringstream into deref pointer to uninit var / #11804 FP uninitvar for array in struct in struct (#5311) 2023-08-11 18:45:58 +02:00
Oliver Stöneberg 45de338f1b
cleaned up includes based on include-what-you-use / iwyu.yml: updated to yet another distro to get the latest version and updated the Chaotic-AUR key (#5267)
This is a mess. The version is AUR is still outdated and also doesn't
install anymore. Fedora 38 carries the latest version of it so use that
now. Keep the old steps in case we need to switch again in the future.
2023-08-02 10:36:17 +02:00
Paul Fultz II 92caa835b6
Fix 11806: FP uninitvar for reference to unitvar in ternary ?: operator (#5247) 2023-07-17 10:34:54 +02:00
chrchr-github 72212331fb
Fix #11832 False positive: uninitialized variable '*(&var) = 0' (#5241) 2023-07-14 19:14:33 +02:00
chrchr-github 4eebf2e733
Fix uninitdata regression (#5179) 2023-06-21 21:19:22 +02:00
chrchr-github f96e3c9d84
Fix #11766 FP uninitdata with cast (#5170) 2023-06-20 18:06:57 +02:00
orbitcowboy fd3befe60a
Added a regression test for FP #10681 uninitvar. (#5168)
Test case is from: https://trac.cppcheck.net/ticket/10681#comment:10
2023-06-17 15:45:28 +02:00
Daniel Marjamäki 9a290c959f
Fix #11776 (False positive: uninitialized variable, struct array member initialized in function) (#5165) 2023-06-17 10:20:20 +02:00
Daniel Marjamäki f6a65afdee
Fix FP uninitStructMember when other variable is only nonzero if struct member is initialized (#5143) 2023-06-10 21:35:17 +02:00
chrchr-github ec2f00d7c2
Fix #1175 uninitialized data: casted to 'int *' and dereferenced (#5008) 2023-05-29 15:29:53 +02:00
Anton Lindqvist 3d6c453058
Fix uninitvar false positive in designed initializers (#5079)
Stop interpreting struct fields in designed initializers as usage of local
variables which can happen if they share the same name.

```
$ cat test.c
struct a { int b; };
int main() {
  char *b;
  extern int foo(struct a *);
  return foo(&(struct a){.b = 0});
}
$ cppcheck --quiet test.c
test.c:5:27: error: Uninitialized variable: b [legacyUninitvar]
  return foo(&(struct a){.b = 0});
```
2023-05-26 11:59:10 +02:00
chrchr-github 096d3a78b0
Fix #10596 FN uninitdata with value initialization (#5056)
* Assign values to pointers with C++11 init

* Handle assigning empty init list

* Fix #10596 FN uninitdata with value initialization

* Fix test
2023-05-13 22:07:09 +02:00
chrchr-github a31c996a70
Add tests for #11075, #11382 (#5035) 2023-05-04 20:35:56 +02:00
Oliver Stöneberg 5833fc3c19
testrunner: even more `SettingsBuilder` usage and `const` cleanups (#5030)
* moved some of the test-only `Library::loadxmldata()` calls into `test`

* testrunner: reduced need for backup/restore of settings
2023-05-04 10:31:05 +02:00
Paul Fultz II 9770dd7e0b
Fix 11673: FP uninitvar when capturing by reference (#4984)
* Fix 11673: FP uninitvar when capturing by reference

* Format

* Fix tests
2023-05-04 06:03:47 +02:00
chrchr-github f04d47ac61
Fix remaining example from #11131 (#5029) 2023-05-03 16:24:56 +02:00
Oliver Stöneberg 25183ff484
testrunner: more `SettingsBuilder` usage and `const` cleanups (#5026) 2023-05-02 15:54:19 +02:00
Oliver Stöneberg 2935c855c3
reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
chrchr-github 023e79b6c2
Fix #11459 uninitvar false positive (#5011)
* Fix #11459 uninitvar false positive

* Format
2023-04-25 21:01:44 +02:00
chrchr-github 6e5375f7b7
Add tests for #8075, #11608, #11635 (#4995)
* Add tests for #6925, #11042, #11494

* Format

* Add tests for # 6561, #6619, #7475,

* Add tests for #8075, #11608, #11635
2023-04-21 16:09:52 +02:00
chrchr-github 67a8ff0b27
Add tests for # 6561, #6619, #7475 (#4988)
* Add tests for #6925, #11042, #11494

* Format

* Add tests for # 6561, #6619, #7475,
2023-04-20 12:58:50 +02:00
chrchr-github ab24e3a3c8
Fix remaining example from #11599, FN #11646, fix crash (#4929)
* Fix remainig example from #11599

* Fix FP, new warnings

* More warnings

* Use getTokenArgumentFunction()

* Fix crash

* Fix #11646 constParameter not reported with "const * const" parameter

* Fix test

* Fix new warnings

* Add suppression

* Add const, fix suppression
2023-04-06 18:46:45 +02:00
Paul Fultz II 115f17cfe6
ValueFlow: Improve the starting point for uninitialized variables to find more uninitialized usages after many conditionals (#4930) 2023-04-04 21:55:09 +02:00
chrchr-github a336048d14
Fix #11599 false negative: constParameter (#4902)
* Partial fix for #11599 false negative: constParameter

* Adjust test

* Update testother.cpp

* Update testother.cpp

* Fix #11599 false negative: constParameter

* Fix new warnings

* Format

* Add difference_type

* Remove isAliased()

* Undo

* Adjust test

* Add test

* Improve const check

* Tweak constness, add tests

* Add tests

* Use new helper function, fixtest

* Remove bailout, fix check for cast

* Prevent FP

* Fix constVariable check, add tests

* Format

* Format

* Add test for #11632
2023-04-02 20:36:23 +02:00
Paul Fultz II fd8a7b9537
ValueFlow: Evaluate if statement for function returns (#4908) 2023-03-24 13:31:26 +01:00
chrchr-github 0d02c0a1a7
Fix #11624 FP uninitvar with array passed to function (#4903) 2023-03-20 19:54:31 +01:00
Daniel Marjamäki a4d2178f3c Fix ctuuninitvar false positive for struct that is partly initialized 2023-03-13 20:55:11 +01:00
Oliver Stöneberg e2f38fdaf3
removed `experimental` and `safe` from `Certainty` (#4819) 2023-03-12 14:15:29 +01:00
chrchr-github b4c90f8b2a
Fix #11597 FP uninitvar with nested enum (#4847) 2023-03-04 11:57:12 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg 1d3955bd92
renamed some files in the `test` folder (#4705) 2023-01-27 08:18:32 +01:00
Oliver Stöneberg fd15811215
de-coupled `--check-library` from `information` severity and other dependencies (#3861) 2023-01-26 22:28:04 +01:00
chrchr-github a79dff15ab
Fix #11492 FP uninitvar with try/catch (#4711) 2023-01-14 20:14:38 +01:00
chrchr-github f793b7dd35
Fix #11460 unintvar false positive (#4674)
* Fix #11460 unintvar false positive

* Format
2023-01-02 17:44:52 +01:00
Paul Fultz II 7acbb656f3
Fix 11412: False positive: uninitvar (#4624)
* Dont remove modified variables from dead code

* Add test for 11412

* Format
2022-12-09 07:15:47 +01:00
chrchr-github 89dba226dd
Fix #11305 FP uninitvar with unseen typedef (#4612) 2022-12-07 09:14:22 +01:00
chrchr-github 6c24d2b865
Fix #11321 FP uninitvar for in-class member initialization (#4547) 2022-10-14 19:48:27 +02:00
chrchr-github 31118fdce5
Fix noreturn FP with while() (#4429)
* Fix checkLibraryFunction FPs

* Fix FP with fclose()

* Format

* Fix FP with reinterpret_cast

* Fix noreturn FP with while()
2022-09-04 10:26:31 +02:00
Tau c17e2b9826
Correctly interpret boolean literals in `execute()` (#4251)
* Correctly interpret boolean literals in `execute()`

* Add regeression test case for boolean literals
2022-07-08 12:39:29 +02:00
Paul Fultz II 185294499c
Adjust the severity of the uninitvar (#4234) 2022-06-28 22:52:35 +02:00
chrchr-github 11860cce4b
Add test for #10463 (#4231)
* Add test for #10643

* Comment

* Fox comment
2022-06-24 13:55:04 +02:00
chrchr-github 6f5a5fd947
Add some tests (#4211)
* Add test for #10152

* Add test for #9773

* Fix test

* Add test for #7529

* Add test for #6371

* Add test for #6475

* Format

* Format

* Fix test

* Remove duplicate test

* Add valueflow test

* Rebuild
2022-06-14 09:54:45 +02:00
chrchr-github ad547af6f9
Add tests for #6323, #6855, #6857 (#4096)
* Add tests for #6870, #10749

* Add test for #6372

* Add tests for #6855, #6857

* Add test for #6323

* Comment
2022-05-10 18:25:01 +02:00
chrchr-github adba751217
Fix #11018 FP uninitvar with redundant pointer op (#4082)
* Skip redundant pointer op

* Fix  #11018 FP uninitvar with redundant pointer op

* Format
2022-05-05 06:54:27 +02:00
Paul Fultz II 496b45f27b
Fix 11009: FP uninitvar (#4076)
* Fix 11009: FP uninitvar

* Format
2022-05-04 05:59:01 +02:00
Paul Fultz II aafd1e10be
Fix 11006: FP uninitvar with unknown constant (#4056) 2022-04-28 10:48:37 +02:00