8995 Commits

Author SHA1 Message Date
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 9d1755f449a75d87bab9fb62b4729a4d5c479889.
2019-03-19 13:16:22 +01:00
Daniel Marjamäki
9d1755f449 Revert "CheckBufferOverrun: Handle multidimensional arrays"
This reverts commit e98a4a6f1475db03473d544d576827e49f9a9575.
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
Daniel Marjamäki
a2a216bbe3 SymbolDatabase: Improved handling of 'normal' non simplified token list 2019-03-15 19:00:42 +01:00
Daniel Marjamäki
92485245ce Restore severity for 'autoVariables' 2019-03-15 15:13:11 +01:00
versat
6f7612de03 boost.cfg: Add argument directions; some fixes; rearrange and document.
- Remove redundant function configurations for the same function since
it is not (yet) possible to configure overloaded functions. Instead mark
the optional arguments with `default="0"` so the configuration works
with a different number of arguments.
- Add documentation to boost.cfg (links and function declarations).
- Rearranged configurations so functions, defines, ... are together now.
- Add `direction` for function arguments where applicable.
- Add some tests to boost.cpp.
2019-03-15 11:13:08 +01:00
Daniel Marjamäki
3656f1ae4f Auto variables: Fix false negatives for normal tokens 2019-03-14 13:51:35 +01:00
versat
3d02c10fde gnu.cfg: Further fixes, enhancements and adding argument directions. 2019-03-14 09:26:27 +01:00
Daniel Marjamäki
6eeee743d2 Auto variables: Minor cleanup 2019-03-14 06:41:11 +01:00
Daniel Marjamäki
703e0a0153 Appveyor: Try to #include proper header for std::uint16_t 2019-03-13 21:44:26 +01:00
Daniel Marjamäki
1ca6d9c847 Appveyor: Fix missing #include for uint16_t 2019-03-13 19:01:54 +01:00
Daniel Marjamäki
cdeb91bfcc Travis: Restore the uint8_t arrays 2019-03-13 18:59:55 +01:00
Daniel Marjamäki
b984897526 ValueFlow: Fix sizeof for array of library type 2019-03-13 18:31:41 +01:00
Sebastian
1230357146
Library: Add initial configuration with tests for SQLite3 library. (#1737) 2019-03-13 13:57:40 +01:00
Daniel Marjamäki
f9ce5b3407 Travis: quick fix for 'make checkcfg' 2019-03-13 09:30:59 +01:00
Daniel Marjamäki
81a1d744c6 CheckBufferOverrun: fix FP for array definition of static class member 2019-03-13 06:39:09 +01:00
Daniel Marjamäki
67e8b99c2c CheckBufferOverrun: Readd a check for strncpy/memcpy/etc 2019-03-12 21:15:26 +01:00
Daniel Marjamäki
11e32ff445 ValueFlow: Handle compound assignments in execute() 2019-03-12 18:53:58 +01:00
Daniel Marjamäki
1d135d1a12 Added test/testsuites/readme.txt 2019-03-12 09:13:20 +01:00
Daniel Marjamäki
f986380b14 Added test/testsuites folder
My idea with this folder is to collect external suitable test cases so we can test Cppcheck on these.
2019-03-12 09:10:37 +01:00
Daniel Marjamäki
0c08f6db6c CheckBufferOverrun: Use AST to lookup array 2019-03-12 06:46:38 +01:00
Daniel Marjamäki
ea23033a65 Array index out of bounds: Fix false positive 2019-03-11 20:33:08 +01:00
Daniel Marjamäki
7b17b33a49 ValueFlow: fix handling of sizeof(*p) 2019-03-11 20:32:24 +01:00
Daniel Marjamäki
bd048085bd Add CheckBufferOverrun::arrayIndexThenCheck 2019-03-11 19:20:06 +01:00
Daniel Marjamäki
27d750b3a1 Travis: Fix 'make checkcfg' 2019-03-11 13:43:15 +01:00
Daniel Marjamäki
729f57d8f1 Start a major rewrite of CheckBufferOverrun. For now only the 'array index' and 'buffer overflow' checks are rewritten.
There are important TODOs still; for instance adding CTU support using our CTU infrastructure, add handling of pointers (maybe I'll use FwdAnalysis for this), add handling of multidimensional arrays, etc..
2019-03-11 12:34:33 +01:00
Rikard Falkeborn
a4269042e8 Add regression test for #8994 (#1733)
Trac ticket #8994 was fixed in b222953baeaafb4ca53760a1d054ed5516c42e08.
Add a regression test to ensure it stays fixed.
2019-03-11 06:14:37 +01:00
Rikard Falkeborn
6a3dd9a185 Handle concatenated string and char literals
This handles concatenated strings and characters from simplecpp.
Previously, L'c' would be preprocessed to the tokens  "L" and "'c'".
cppcheck would then remove the "L" token and set "'c'" to be a wide
character literal. Now, it needs to remove the prefix instead.

When doing this, add handling of utf32 encoded literals (U) and UTF-8
encoded literals (u8).
2019-03-10 10:38:50 +01:00
Daniel Marjamäki
69c05acd3b CheckBoost: Use 'normal' checking 2019-03-09 20:00:31 +01:00
Daniel Marjamäki
e17ddfd964 Changed AST for variable declarations with initializations 2019-03-09 19:09:15 +01:00