Commit Graph

468 Commits

Author SHA1 Message Date
PKEuS cf1937294a Refactorization: Removed unnecessary \n and spaces in strings
Merged from LCppC.
2021-02-20 12:58:42 +01:00
Paul Fultz II 25ada657da
Fix issue 9030: ValueFlow: Possible value after conditional assignment in for loop (#3059) 2021-01-18 10:12:07 +01:00
Oliver Stöneberg 96704c9971
fixed and enabled some more clang-tidy warnings (#3007) 2021-01-05 17:51:32 +01:00
Paul Fultz II 9ec27c112f
Fix issue 9855: false positive: uninitvar (#2754) 2020-08-26 07:02:15 +02:00
Daniel Marjamäki 120c572252 Fixed #9750 (Chained stream operation gives uninitvar error) 2020-06-06 15:24:01 +02:00
miltolstoy 79c3af56e4
fix 9296: false negative uninit variable (#2663) 2020-05-28 21:28:18 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Daniel Marjamäki 4779cb124e Fixed #9649 (False positive: uninitialized struct member) 2020-05-07 22:27:18 +02:00
Daniel Marjamäki c029d5150c Fixed #9123 (False positive: uninitialized variable) 2020-04-10 12:33:15 +02:00
Paul Fultz II 6ea4f60600
Enable valueFlowSubfunction for multiple parameters (#2550) 2020-03-01 16:46:20 +01:00
Rikard Falkeborn 9896dce7f2
checkuninitvar: Fix FN with c++ casts (#2549) 2020-02-23 19:53:17 +01:00
Paul Fultz II 921887a281
Use valueFlowGeneric for valueFlowForwardExpression (#2537) 2020-02-16 16:02:22 +01:00
Paul Fultz II 7368a54629
Add generic valueflow forward analysis (#2511) 2020-02-13 16:27:06 +01:00
Daniel Marjamäki ca3095746c Fixed #9594 (False positive: Using argument that points at uninitialized variable when write only) 2020-02-04 18:56:18 +01:00
Daniel Marjamäki 02eaf6fa93 Fixed #8998 (False positive uninitStructMember related to reference to member) 2019-12-19 20:18:32 +01:00
Daniel Marjamäki bae4faa786 Fixed #9422 (FP uninitdata - writing pointer to output stream) 2019-11-16 11:47:57 +01:00
IOBYTE f88ae21d8f Fix #9467 (False positive on local variable when template specialization is used) (#2357) 2019-11-13 21:34:27 +01:00
Paul Fultz II 7841430793 Fix issue 9428: FP uninitvar for pointer passed to sscanf (#2344)
* Add indirect to library cfg files

* Check indirect for non null arguments

* Reenable subfunction analysis

* Use indirect 1 when using not-null

* Parse correct string name

* Update documentation

* Make attribute optional
2019-11-13 12:46:54 +01:00
Daniel Marjamäki f5a6aa530d Fixed #9417 (FP uninitvar - member initialized in operator()) 2019-11-11 15:00:53 +01:00
Paul Fultz II 6f29e299fc Fix issue 9439: false positive: unique_ptr and nullPointerRedundantCheck (#2346) 2019-11-10 09:44:59 +01:00
Daniel Marjamäki c3ae028a41 Fixed #8617 (False positive: uninitdata for memory allocated and initialized in function called new (C code)) 2019-11-03 17:08:28 +01:00
Paul Fultz II 02150e741d Fix issue 7836: Add regression test (#2308) 2019-10-30 12:12:02 +01:00
Daniel Marjamäki 210232d35c Fixed #9314 (false positive: (error) Uninitialized variable: ret) 2019-10-29 20:36:58 +01:00
Daniel Marjamäki 15d7b9c83f Fixed #9347 (FP uninitvar for pointer passed to sscanf) 2019-10-17 17:41:54 +02:00
Daniel Marjamäki da363c7d6f Fixed #9349 (FP ctuuninitvar for pointer dereferenced inside sizeof) 2019-09-12 13:29:52 +02:00
Paul Fultz II 2595b82634 Fix issue 9348: FP uninitvar for pointer passed to memcpy (#2167) 2019-09-10 19:40:08 +02:00
Sebastian 4a119640c5 #8755: Add regression test (#2160)
* #8755: Add regression test

https://trac.cppcheck.net/ticket/8755
False negative: uninitvar not detected

* Fixed formatting (runastyle)
2019-09-09 17:20:03 +02:00
Paul Fultz II 1afd56e964 Fix issue 8785: ValueFlow: Track pointer alias
This fixes the issue by making `ProgramMemory` keep track of values based on the conditions.

It also removes the `deadpointer` check since it duplicates the `invalidLifetime` check.
2019-09-03 17:16:15 +02:00
Paul Fultz II 55a78f482b Fix issue 9293: false negative: uninitvar 2019-09-03 06:46:34 +02:00
Daniel Marjamäki 7d63bdee6f astyle formatting
[ci skip]
2019-09-02 06:59:07 +02:00
Ken-Patrick Lehrmann 7a75aa084b Fix crash in CheckUninitVar (#2129)
http://cppcheck.osuosl.org:8000/ycmd
```
2019-08-30 23:21
ftp://ftp.se.debian.org/debian/pool/main/y/ycmd/ycmd_0+20181101+git600f54d.orig.tar.gz
cppcheck-options: -j1 --library=posix --library=gnu --library=qt --library=python --library=googletest --library=boost -D__GNUC__ --check-library --inconclusive --enable=style,information --platform=unix64 --template=daca2 -rp=temp temp
platform: Linux-4.15.0-58-generic-x86_64-with-Ubuntu-18.04-bionic
python: 2.7.15+
client-version: 1.1.31
cppcheck: head 1.88
count: Crash! 83
elapsed-time: -11.0 61.2
head results:
Checking temp/ycmd-0+20181101+git600f54d/ycmd/tests/clang/testdata/completion_fixit.cc: __GNUC__=1...

Program received signal SIGSEGV, Segmentation fault.
CheckUninitVar::valueFlowUninit (this=this@entry=0x7fffffffb350) at build/checkuninitvar.cpp:2376
2376	            if (!tok->variable())
 #0  CheckUninitVar::valueFlowUninit (this=this@entry=0x7fffffffb350) at build/checkuninitvar.cpp:2376
 #1  0x00005555556901ac in CheckUninitVar::runChecks (this=<optimized out>, tokenizer=0x7fffffffbcb0, settings=0x7fffffffcd10, errorLogger=<optimized out>) at lib/checkuninitvar.h:68
 #2  0x00005555556a2210 in CppCheck::checkNormalTokens (this=this@entry=0x7fffffffcaf0, tokenizer=...) at build/cppcheck.cpp:730
 #3  0x00005555556a6ee2 in CppCheck::checkFile (this=this@entry=0x7fffffffcaf0, filename="temp/ycmd-0+20181101+git600f54d/ycmd/tests/clang/testdata/completion_fixit.cc", cfgname="", fileStream=...) at build/cppcheck.cpp:540
 #4  0x00005555556aad4c in CppCheck::check (this=this@entry=0x7fffffffcaf0, path="temp/ycmd-0+20181101+git600f54d/ycmd/tests/clang/testdata/completion_fixit.cc") at build/cppcheck.cpp:195
 #5  0x00005555557ef167 in CppCheckExecutor::check_internal (this=this@entry=0x7fffffffd880, cppcheck=..., argv=argv@entry=0x7fffffffdc08) at cli/cppcheckexecutor.cpp:884
 #6  0x00005555557efa9a in CppCheckExecutor::check (this=0x7fffffffd880, argc=17, argv=0x7fffffffdc08) at cli/cppcheckexecutor.cpp:198
 #7  0x00005555555b1d1b in main (argc=17, argv=0x7fffffffdc08) at cli/main.cpp:95
```
2019-09-01 14:51:40 +02:00
Paul Fultz II 0b9e823fc8 Fix issue 9305: False positive uninitvar - struct initialized via function (#2123) 2019-08-30 18:32:45 +02:00
Paul Fultz II 2942be53f7 Add more tests for valueFlowUninit (#2124) 2019-08-30 08:41:17 +02:00
Paul Fultz II 03fe6795bf Fix issue 9302: FP uninitvar - struct accessed via pointer (#2121) 2019-08-29 08:38:50 +02:00
amai2012 1538248922 Fix syntax in test code example 2019-08-26 20:45:14 +02:00
Daniel Marjamäki 9d26be8380 Fixed #5259 (Improve check: Uninitialized variable not reported when used in array initialization) 2019-08-24 14:43:35 +02:00
Paul Fultz II 5c488b9519 Fix issue 9190: FP uninitvar for struct member (#2112)
* Fix issue 9190: FP uninitvar for struct member

* Add more test cases

* Fix false negative
2019-08-24 11:27:47 +02:00
Daniel Marjamäki 35fb55d76c Fixed #5259 (Improve check: Uninitialized variable not reported when used in array initialization) 2019-08-24 08:01:55 +02:00
Paul Fultz II c0a8d628b9 Fix issue 6010: Uninitialized inner struct (#2098)
* Fix issue 6010: Uninitialized inner struct

* Show to root variable that is unitialized

* Warn on pointer dereferences
2019-08-23 06:23:20 +02:00
Paul Fultz II 1f747d0b14 Add regression test for 9281 (#2097) 2019-08-19 09:09:07 +02:00
Paul Fultz II ee7fe3aaa1 Fix FP: Unitialized variable when using a pointer
This fixes the FP in cases like this:

```cpp
void f() {
    bool b;
    bool * x = &b;
    if (x != nullptr)
        x = 1;
}
```

It tracks the indirection of the uninit value in valueflow.
2019-08-17 07:36:41 +02:00
Paul Fultz II 3aef0c9bd3 Fix issue 8715: regression uninitvar not detected (#2092) 2019-08-16 07:48:54 +02:00
Paul Fultz II af214e8212 Fix issue 8825: ValueFlow: uninitialized struct member (#2087)
* Pass uninit value across pointers

* Add more testing
2019-08-15 10:44:55 +02:00
Daniel Marjamäki e11dcc609b Fixed #7758 (Function array is seen as Uninitialized) 2019-07-24 18:20:23 +02:00
Rikard Falkeborn 06337cedf5 Run more tests on full token list (#2020)
Since all checks are run on the full token list and not the simplified
one, run the tests on the full token list as well.
2019-07-22 10:26:55 +02:00
Daniel Marjamäki 7ca35d181b uninitStructMember: Fixed FP shown in daca@home 2019-06-02 20:19:53 +02:00
Daniel Marjamäki b9ac77a31b Uninitialized variables: Fixed false positive 2019-03-09 11:30:45 +01:00
Sebastian c8003d47e2
checkuninitvar.cpp: Use argument direction "out" info from library cfg (#1730)
CheckUninitVar::isMemberVariableAssignment uses argument direction "out"
now also to check for assignment when the member variable is handed over
to a function by reference.
testuninitvar.cpp: Improve tests, use a test library configuration.
2019-03-08 18:42:24 +01:00