Daniel Marjamäki
f26b15e5b5
astyle formatting
...
[ci skip]
2019-04-16 19:07:44 +02:00
Daniel Marjamäki
253f2c9e9d
Fixed #9043 (false positive & regression: Variable '*s' is reassigned a value before the old one has been used.)
2019-04-16 19:07:26 +02:00
bbennetts
7287ffe781
Handle 'arguments' sections in compile_commands.json ( #1797 )
...
* Handle 'arguments' sections in compile_commands.json
Previous code assumes 'commands' exists and ill assert if t does not.
* Correct typo checking for "arguments" rather than "commands"
* Use ostringstring rather than stringstream
* Add test deominstrating graceful degradation
* Add test for parsing "arguments" rather than "commands"
2019-04-15 20:03:42 +02:00
Daniel Marjamäki
9a563a7d60
test/cli: Add test for cppcheck gui project with addons
2019-04-15 20:02:17 +02:00
Daniel Marjamäki
2156dd7a40
test/cli: Add test importing a vs solution with absolute path
2019-04-15 19:53:49 +02:00
Daniel Marjamäki
146683fdeb
test/cli: Add one more exclude path test
2019-04-15 19:46:12 +02:00
Daniel Marjamäki
83f8d7fab9
test/cli: Improved proj2 testing. fixed bug for relative path when vs-solution is imported with relative path
2019-04-15 19:00:57 +02:00
Daniel Marjamäki
6549aed6f4
test/cli: Added testutils.py
2019-04-15 16:57:16 +02:00
Daniel Marjamäki
a03455c505
test/cli: test function that creates gui project file
2019-04-15 15:03:06 +02:00
Daniel Marjamäki
58f886c725
test/cli: Add tests for suppressions
2019-04-15 11:11:33 +02:00
Daniel Marjamäki
65d18b3da9
test/cli: refactorings
2019-04-15 10:02:25 +02:00
Daniel Marjamäki
1a8a40ea35
test/cli: tweak exclude path to make it work in windows
2019-04-15 09:11:23 +02:00
Daniel Marjamäki
4adc3773c5
test/cli: add vs project
2019-04-15 09:04:23 +02:00
Daniel Marjamäki
b845ec41d4
test/cli: renamed tests
2019-04-15 08:53:23 +02:00
Daniel Marjamäki
15eba39963
test/cli: better handling of absolute ignored paths
2019-04-15 08:48:58 +02:00
Paul Fultz II
a90caa7e5a
Fix issue 9006: False positive: Return value of function std::move() is not used.
...
This is trying to fix the issue by fixing the ast and symbol database. First, the ast nodes will be created for the init list and the symbol database will not mark it as a scope. I am not sure if this is the correct approach as I dont really understand how the AST part works.
It did change the AST for `try {} catch (...) {}` but that is because it incorrectly treats `try {}` as an initializer list.
2019-04-15 06:37:27 +02:00
Daniel Marjamäki
a3efe4e03c
test/cli: added proj2 test project
2019-04-14 21:02:53 +02:00
Daniel Marjamäki
57479dc948
test/cli: importing cppcheck gui project that imports vcxproj
2019-04-14 18:21:27 +02:00
Daniel Marjamäki
7a122cc846
test/cli: import vs project with absolute path
2019-04-14 18:09:35 +02:00
Daniel Marjamäki
fd0309db9b
test/cli: Add tests that loads vs project
2019-04-14 16:48:59 +02:00
Daniel Marjamäki
a18025c95d
test/cli: tweaks for running it in windows
2019-04-14 15:53:32 +02:00
Daniel Marjamäki
2cd5a8fde0
test/cli/1-helloworld: add vs solution/project
2019-04-14 15:11:39 +02:00
Daniel Marjamäki
b94f4176f1
test/cli: execute addon
2019-04-14 15:00:03 +02:00
Daniel Marjamäki
6a83c5d3f3
Add cli testing
2019-04-14 10:46:47 +02:00
Daniel Marjamäki
1393c1c3a0
AST: Try to handle C++17 syntax 'if (init;expr)'
2019-04-12 17:35:06 +02:00
Daniel Marjamäki
773d19b2d6
Fix compiler errors. After removing the -std=posix.
2019-04-12 10:41:53 +02:00
Daniel Marjamäki
292b679aba
Fixed build error. Renamed variable
2019-04-10 19:17:24 +02:00
Daniel Marjamäki
4686cae929
simplifyMathExpression: Fix tests
2019-04-09 08:22:41 +02:00
Daniel Marjamäki
7610513c49
Fixed #9090 (Do not simplify standard functions)
2019-04-08 19:00:46 +02:00
Daniel Marjamäki
83106d5827
Unused templates: Remove unused template function with variadic arguments
2019-04-07 08:37:04 +02:00
Rikard Falkeborn
82a1e3c61c
CheckInternal: Extend redundant null pointer check before Token::Match() ( #1789 )
...
Improve the internal check for redundant null pointer check before
calling Token::Match() (and friends). Now, warn about code snippets like
if (a && tok && Token::Match(tok, "foo"))
Also, extend the check for the inverted case.
There is still no warning for
if (tok && a && Token::Match(tok, "foo"))
since that would require checking if a is independent of tok.
2019-04-06 07:44:44 +02:00
Rikard Falkeborn
295153df72
Checkstring fixes ( #1783 )
...
* teststring.cpp: Fix ternary syntax in tests
* stringLiteralWrite: Add tests wide character and utf16 strings
* suspiciousStringCompare: Add test with wide character string
* strPlusChar: Handle wide characters
* incorrectStringCompare: Add test with wide string
* Suspicious string compare: suggest wcscmp for wide strings
* deadStrcmp: Extend to handle wide strings
* sprintfOverlappingData: Print name of strcmp function
* Conversion of char literal to boolean, add wide character tests
* Conversion of char literal to boolean, fix ternary
2019-04-06 06:54:38 +02:00
Oliver Stöneberg
16ebb90b32
library.cpp: optimized Library::detectContainer() ( #1778 )
...
* library.cpp: optimized Library::detectContainer()
reduces Ir from 5882 to 1149 according to callgrind
* fixed hang in tests
2019-04-06 06:42:01 +02:00
IOBYTE
5cdde701ba
template simplifier: add minimal template template support ( #1779 )
2019-04-04 06:07:49 +02:00
Daniel Marjamäki
de4f57ec0f
Buffer overflow: Add CTU checking for pointer arithmetic overflows
2019-04-03 06:43:56 +02:00
IOBYTE
9f3ecdde31
Fixed #9076 (Template Simplifier : template < template <typename> T >) ( #1777 )
...
This does not add support for template templates. It only skips the
template template parameter.
2019-04-03 06:02:38 +02:00
Daniel Marjamäki
3f9dd4c567
Variable scope: Fix FP for reference variable in range for loop
2019-04-02 12:59:24 +02:00
Daniel Marjamäki
761f18c75c
Fixed #8988 (False positive: using memset on struct)
2019-04-01 19:32:03 +02:00
versat
974f01ce59
gtk.cfg: Add / improve g_str*() functions and add GTK_SIGNAL_FUNC().
2019-04-01 16:15:32 +02:00
versat
9d8b965270
gtk.cfg: Add / improve g_string_*() function configurations.
...
daca@home reported missing configurations for most of them.
2019-04-01 15:33:27 +02:00
Daniel Marjamäki
fbc769266c
Fixed #9060 (TemplateSimplifier::templateParameters : var <...>)
2019-03-31 16:29:28 +02:00
Daniel Marjamäki
0efddc4010
astyle formatting
...
[ci skip]
2019-03-31 16:20:06 +02:00
Daniel Marjamäki
29a5404d1e
Incomplete statement: Fix FP for 'ar & x'
2019-03-31 11:50:57 +02:00
Daniel Marjamäki
73433c2961
Syntax error: Clarify a syntax error in audacity
2019-03-31 10:46:59 +02:00
Daniel Marjamäki
b30d463baf
Fix wrong syntax error
2019-03-31 09:34:19 +02:00
Daniel Marjamäki
c5807459f9
CheckBufferOverrun: Add check for pointer arithmetics
2019-03-31 09:00:52 +02:00
Daniel Marjamäki
4107671549
TestBufferOverrun: Uncommented and moved CTU tests
2019-03-30 15:10:00 +01:00
Daniel Marjamäki
b0c58f2b10
Fixed #9000 (SymbolDatabase: lambda scope)
2019-03-30 10:32:36 +01:00
Daniel Marjamäki
fe285f1df3
Fixed #9055 (SymbolDatabase: second argument is missing in the symbol database)
2019-03-30 07:44:36 +01:00
IOBYTE
d88ee2d6a2
Fixed #9070 (Segmentation fault in TemplateSimplifier::simplifyTemplateAliases (scram package)) ( #1771 )
...
This only fixes the crash. It does not fix the underlying problem of
template using with templates of templates causing the use of deleted
instantiations.
2019-03-30 06:53:17 +01:00
Daniel Marjamäki
b5a285319c
Fixed #9073 (Segmentation fault in Token::isUnaryOp() with ode)
2019-03-29 19:37:23 +01:00
Daniel Marjamäki
54bea2847a
STL: Better out of bounds checking for empty containers when index is unknown
2019-03-29 15:20:17 +01:00
Daniel Marjamäki
3c30d274a0
Clarify STL out of bounds warning message
2019-03-29 11:13:25 +01:00
Daniel Marjamäki
e88a0c00c1
Fixed #9039 (STL: array index out of bounds: str.begin() + 1)
2019-03-28 12:49:52 +01:00
IOBYTE
22f01f035c
Fixed #9042 (Another `using BOOL` type breach) ( #1765 )
2019-03-27 21:42:50 +01:00
Daniel Marjamäki
0f6a90c595
Fixed #9069 (crash on invalid code: ' x= y{ } name5 ')
...
Credit to OSS-Fuzz for reporting this!
2019-03-27 18:17:11 +01:00
Frank Zingsheim
574b77cf1f
Fixed: FP return reference to thread_local variable ( #1758 )
2019-03-27 12:22:53 +01:00
Daniel Marjamäki
c77f31319d
Fix crash when checking re2c textfile
2019-03-26 20:51:41 +01:00
Rikard Falkeborn
6b478c362e
Allow multiple test case arguments to testrunner ( #1755 )
...
Take some care to not run the same test case twice, even if running:
./testrunner TestClass TestClass::TestCase
2019-03-26 20:28:40 +01:00
Daniel Marjamäki
c262aeffdd
Fixed #9068 (crash on invalid code)
2019-03-26 19:57:32 +01:00
Daniel Marjamäki
15676612c0
Fixed #9034 (crash on reading invalid code: '> typedef')
2019-03-26 16:14:24 +01:00
Sebastian
6976d5c6e2
gtk.cfg: Add support for g_new() and similar macros. ( #1760 )
...
Also add / improve corresponding function configurations and some tests.
2019-03-26 10:45:06 +01:00
IOBYTE
5b72e1f568
Fixed #9040 (Type alias 'BOOL' declared with 'using' keyword breaks type detection) ( #1759 )
...
Moved simplifyUsing from TemplateSimplifier to Tokenizer.
2019-03-26 07:09:56 +01:00
Daniel Marjamäki
49e2f9d551
Fixed #9063 (Crash on invalid code: x='0' ++ '0' ( return)[ ];)
2019-03-25 15:29:23 +01:00
IOBYTE
10fcf731d9
Fixed #9021 (template simplifier: crash in simplifyCalculations) ( #1757 )
2019-03-25 14:56:51 +01:00
orbitcowboy
9bfe7d74c0
windows.cfg: Fixed FP for invalidFunctionArg in second argument of _getcwd(). Reference: https://docs.microsoft.com/en-us/previous-versions/sf98bd4y(v%3Dvs.140)
2019-03-25 09:07:02 +01:00
IOBYTE
b6faa11fbf
Fixed #9056 ("using namespace" inside namespace causes "SymbolDatabase bailout;) ( #1753 )
...
Fixed the bailout warning and one of the varid bugs.
The trailing return type still has a varid.
2019-03-24 17:31:34 +01:00
Daniel Marjamäki
e0f1418228
Fixed #9034 (Tokenizer::setVarId: function call parameter is not variable declaration)
2019-03-24 07:06:21 +01:00
Daniel Marjamäki
418eb43d45
Fixed #9032 (False-positive detection of reassigned value before used for pointer parameter)
2019-03-23 19:01:02 +01:00
Daniel Marjamäki
a9082c902a
Fixed #9058 (crash on invalid code in FwdAnalysis::checkRecursive)
2019-03-23 18:27:41 +01:00
Daniel Marjamäki
d6b806c592
CheckBufferOverrun: Better CTU checking when variable address is passed
2019-03-23 15:57:17 +01:00
Daniel Marjamäki
9653760547
CheckBufferOverrun: Improved CTU analysis for array
2019-03-23 11:20:35 +01:00
IOBYTE
40af889df0
Fixed #9053 (simplifyTypedef: wrong simplification of '(const d)' when 'd' is a array) ( #1751 )
...
* Fixed #9053 (simplifyTypedef: wrong simplification of '(const d)' when 'd' is a array)
* fix whitespace
2019-03-23 10:45:38 +01:00
Daniel Marjamäki
15fc9a622d
CheckBufferOverrun: Add CTU analysis
2019-03-23 08:36:10 +01:00
versat
0d14bdac22
windows.cfg: Add "buffer-size" attributes, fix allocation configuration.
...
Memory allocated with `_aligned_*malloc*()` must be freed with
`_aligned_free*()`. Using `free()` is illegal.
See
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/aligned-malloc
for details.
Also add tests for some of the changed functions.
2019-03-22 13:11:03 +01:00
Paul Fultz II
91138578cc
Fix 9052: Crash: SIGSEGV in Token::previous (this=0x0) while checking mariadb-10.0
2019-03-22 01:56:09 +01:00
versat
7c09b0cfe0
gnu.cfg: Add "buffer-size" attribute and tests for xcalloc().
2019-03-21 10:44:18 +01:00
versat
316475f79f
std.cfg: Add "buffer-size" attribute and tests for aligned_alloc().
2019-03-21 09:25:42 +01:00
Daniel Marjamäki
031362ae01
CheckBufferOverrun: Fix false positive
2019-03-19 21:07:08 +01:00
versat
9b6b94336c
gnu.cfg: Add buffer-size to xmalloc; add some __builtin_*() functions.
2019-03-19 15:24:02 +01:00
Daniel Marjamäki
a0e58f0039
Revert "Revert "CheckBufferOverrun: Handle multidimensional arrays""
...
This reverts commit 9d1755f449
.
2019-03-19 13:16:22 +01:00
Daniel Marjamäki
9d1755f449
Revert "CheckBufferOverrun: Handle multidimensional arrays"
...
This reverts commit e98a4a6f14
.
2019-03-19 13:13:29 +01:00
Daniel Marjamäki
e98a4a6f14
CheckBufferOverrun: Handle multidimensional arrays
2019-03-19 09:29:32 +01:00
Paul Fultz II
774464eabb
Fix issue 8996: False positive duplicateCondition
...
This fixes issue 8996 by improving the alias checking by using lifetime analysis. It also extends the lifetime checker to handle constructors and initializer lists for containers and arrays.
2019-03-19 06:25:10 +01:00
Daniel Marjamäki
d1025ce76d
Added testcases from 'duma' package
2019-03-18 06:58:12 +01:00
Rikard Falkeborn
794f65bac1
Handle prefixed strings and characters in Token ( #1742 )
...
This makes it possible to call getStrLength() and similar functions
before the tokenizer is called.
2019-03-18 06:18:25 +01:00
Daniel Marjamäki
03f8535c71
Better multiline warning when there is buffer overflow
2019-03-17 20:12:02 +01:00
Daniel Marjamäki
3c85d8a8ac
ValueFlow: Better info for buffer size values
2019-03-17 19:02:36 +01:00
Sebastian
19e9e42dd7
Library: Enhance minsize configuration and allow simple values. ( #1736 )
...
Some POSIX and Windows functions require buffers of at least some
specific size. This is now possible to configure via for example this
minsize configuration: `<minsize type="value" value="26"/>`.
The range for valid buffer size values is 1 to LLONG_MAX
(9223372036854775807)
2019-03-17 14:22:26 +01:00
Daniel Marjamäki
0771929518
Buffer overflow: Handling of dynamically allocated buffer
2019-03-17 13:40:56 +01:00
Daniel Marjamäki
92f4113b59
Array index: Checking array index out of bounds for dynamic buffers
2019-03-17 13:09:15 +01:00
Daniel Marjamäki
b0c92c1ac1
CheckNullPointer: Use library instead of hardcoding
2019-03-17 07:37:38 +01:00
Daniel Marjamäki
87fe5c060e
Refactoring of Null Pointer Checker
2019-03-16 21:21:30 +01:00
Daniel Marjamäki
ebef16b8a3
Travis: Try to remove temporary fix
2019-03-16 18:29:02 +01:00
Daniel Marjamäki
34a8b2b519
Quick fix for 'make checkcfg'
2019-03-16 18:17:16 +01:00
Daniel Marjamäki
e9d29e826f
Travis: Temporarily comment out failing test
2019-03-16 09:48:32 +01:00
Daniel Marjamäki
fb2198fd6b
Travis: Try to fix test
2019-03-16 09:28:00 +01:00
Daniel Marjamäki
3dc34f1515
Disable all simplified checks
2019-03-16 09:17:50 +01:00
Daniel Marjamäki
0e88a17aca
CheckInternal: Use 'normal' checking
2019-03-16 08:51:33 +01:00
Daniel Marjamäki
f40a80c349
Use 'normal' checking instead of 'simplified'
2019-03-16 07:19:48 +01:00