11042 Commits

Author SHA1 Message Date
Daniel Marjamäki
0c08f6db6c CheckBufferOverrun: Use AST to lookup array 2019-03-12 06:46:38 +01:00
Daniel Marjamäki
4ababeb704 Fix 'make checkcfg' 2019-03-11 21:39:39 +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
17253cdb55 buffer overflow: Fix false positive 2019-03-11 19:40:17 +01:00
Daniel Marjamäki
bd048085bd Add CheckBufferOverrun::arrayIndexThenCheck 2019-03-11 19:20:06 +01:00
Daniel Marjamäki
a933261e14 Add message id arrayIndexOutOfBoundsCond 2019-03-11 19:12:03 +01:00
orbitcowboy
0721c9f7f0 Running astyle [ci skip]. 2019-03-11 15:32:30 +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
Daniel Marjamäki
34711bcb93 Remove unused functions 2019-03-11 12:23:22 +01:00
Daniel Marjamäki
df8cfe2fc6 Travis: Fix Cppcheck warning 2019-03-10 12:24:41 +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
3eb5de756c Buffer overrun: Refactorings; use range for loops and write in message 2019-03-09 22:19:09 +01:00
Daniel Marjamäki
4ce6de39c5 CheckCondition: Moved checks to 'normal' 2019-03-09 22:00:59 +01:00
Daniel Marjamäki
ea9b2032c1 CheckClass: Moved checks to 'normal' 2019-03-09 21:38:36 +01:00
Daniel Marjamäki
69c05acd3b CheckBoost: Use 'normal' checking 2019-03-09 20:00:31 +01:00
Daniel Marjamäki
5a42c54d0f CheckBool: Use normal checking 2019-03-09 19:16:07 +01:00
Daniel Marjamäki
ac42382cd9 Rewrite CheckBool::checkAssignBoolToPointer to use ValueType 2019-03-09 19:15:06 +01:00
Daniel Marjamäki
e17ddfd964 Changed AST for variable declarations with initializations 2019-03-09 19:09:15 +01:00
Daniel Marjamäki
1b4895a579 ValueType: Set ValueType for false/true 2019-03-09 17:27:27 +01:00
Daniel Marjamäki
5a32d2d017 Moved CheckAutoVariables::autoVariables to normal checking 2019-03-09 16:53:43 +01:00
Daniel Marjamäki
38d5712aaa Moved CheckAssert::assertWithSideEffects to normal checking 2019-03-09 16:50:50 +01:00
Daniel Marjamäki
b9ac77a31b Uninitialized variables: Fixed false positive 2019-03-09 11:30:45 +01:00
Daniel Marjamäki
f36ca56e7d Moved CheckStl::redundantCondition to normal checking 2019-03-09 07:53:49 +01:00
Daniel Marjamäki
f9fe6cc96a STL: Removed auto_ptr checking. 2019-03-09 07:48:01 +01:00
Daniel Marjamäki
d7a645dcc3 Moved CheckStl::uselessCalls to normal checking 2019-03-09 07:37:08 +01:00
Rikard Falkeborn
a53b016414 checknullpointer: Remove duplicated include (#1732) 2019-03-08 20:55:09 +01:00
Daniel Marjamäki
45a0c2ebf5 Revert "Moved CheckStl::checkAutoPointer to normal checking"
This reverts commit 6dc9727ffd9ebc3351098e3d5ce27aad23738b6a.
2019-03-08 20:53:37 +01:00
Daniel Marjamäki
6dc9727ffd Moved CheckStl::checkAutoPointer to normal checking 2019-03-08 20:41:28 +01:00
Daniel Marjamäki
95a20c0233 Moved CheckStl::string_c_str to normal checking 2019-03-08 20:39:43 +01:00
Daniel Marjamäki
fdf1d6fdee Moved CheckStl::erase to normal checking 2019-03-08 20:36:40 +01:00
Daniel Marjamäki
fdfe39299c Moved CheckStl::pushback to normal checking 2019-03-08 20:33:16 +01:00
Daniel Marjamäki
5fe48f3cd2 Moved CheckStl::mismatchingContainers to normal checking 2019-03-08 20:31:00 +01:00
Daniel Marjamäki
b91bb2e523 Moved CheckStl::iterators to normal checking 2019-03-08 20:28:28 +01:00
Daniel Marjamäki
8f2d70e61d Move CheckStl::if_find to normal checking 2019-03-08 20:23:37 +01:00
Daniel Marjamäki
725abbfac3 Move CheckStl::missingComparison to normal checks 2019-03-08 20:19:40 +01:00
Daniel Marjamäki
75ce67f4b8 Fixed #9027 (cppcheck on Centos 7 - segmentation fault below CheckCondition::multiCondition2) 2019-03-08 19:27:20 +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
amai2012
eb9edbc177 #9024 Crash caused by package "procserv" in lib/token.h:921 function Token::getKnownIntValue - Fix and test for alternative code example. 2019-03-08 11:07:33 +01:00
Daniel Marjamäki
6eaf2c03d9 CheckOther::checkInvalidFree: Move check to normal checking. And clarify the message. 2019-03-07 06:35:44 +01:00
Daniel Marjamäki
17e73fd144 Move CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse to Normal checking 2019-03-06 21:27:19 +01:00
Daniel Marjamäki
f20936ed8a Moved CheckOther::checkPassByReference to normal checking 2019-03-06 20:59:45 +01:00
Daniel Marjamäki
9d5f672dbc Unused struct member: Fix FPs seen in daca@home results for template structs 2019-03-06 20:51:48 +01:00
Daniel Marjamäki
572d7eb86c Moved CheckOther::clarifyCalculation to normal checking 2019-03-06 20:43:28 +01:00
Daniel Marjamäki
ee9053f219 Moved CheckOther::checkRedundantCopy() to normal checking 2019-03-06 20:38:13 +01:00
Sebastian
6228ea2266
checkuninitvar.cpp: Use argument direction info from library config. (#1728)
CheckUninitVar::isMemberVariableAssignment uses argument direction
to check for assignment when the member variable is handed over to a
function by reference. Currently implemented for "in" direction. "out"
will be added with another commit.
2019-03-06 19:26:38 +01:00
Daniel Marjamäki
ad37664e86 Changed severities 2019-03-06 19:00:58 +01:00
Daniel Marjamäki
c32d015337 Fixed false positives from terminateStrncpy 2019-03-06 18:50:50 +01:00
Daniel Marjamäki
3f37d5ac2d Refactoring strncpy/strncat checking to use ValueFlow and AST 2019-03-06 09:04:04 +01:00
Daniel Marjamäki
37814513f8 Revert "Moved all simplified CheckOther checks from simplified to normal checking"
This reverts commit 2900690881c5897b0b1acb35e00ad89b82b48820.
2019-03-06 07:08:56 +01:00