Commit Graph

11627 Commits

Author SHA1 Message Date
Daniel Marjamäki bc39cd73f0 Clang import; fix wrong 'sizeof' import 2020-01-17 03:15:08 +01:00
Daniel Marjamäki 272fbfeb74 ExprEngine; Fix Z3 usage for floats 2020-01-16 19:35:05 +01:00
Daniel Marjamäki bc737be0b5 ExprEngine; OLD_Z3 => NEW_Z3 2020-01-16 18:59:47 +01:00
Dmitry-Me 01e0a61ebe Break loops earlier 2020-01-16 18:37:10 +03:00
Daniel Marjamäki 76a048a2c1 Bug hunting; 'hide' the uninitialized variables checking, I need to focus on division by zero and clang import 2020-01-15 21:06:00 +01:00
Daniel Marjamäki 9507fccfc1 ExprEngine: Quick hacks for old Z3 compatibility 2020-01-15 19:46:00 +01:00
Daniel Marjamäki 52d72b6ffc ExprEngine; Fix crash 2020-01-15 18:35:55 +01:00
Daniel Marjamäki 446e7c3c0e ExprEngine; Fix fp in edgevalue 2020-01-15 17:51:34 +01:00
Daniel Marjamäki c79ec9e956 ExprEngine: sizeof() 2020-01-15 15:24:36 +01:00
Daniel Marjamäki 5ac0eb100c Bug hunting; avoid crash when argument is NULL 2020-01-15 07:15:47 +01:00
Daniel Marjamäki 7820b5dbcc Rename 'Verification' to 'Bug hunting' 2020-01-14 21:17:07 +01:00
Daniel Marjamäki dfbf347912 Clang import; Better type 2020-01-13 17:56:30 +01:00
Daniel Marjamäki a17ded3862 Clang import; handle {} that is not a scope better 2020-01-13 13:16:02 +01:00
Daniel Marjamäki 066e43cce3 Clang import; InitListExpr 2020-01-13 12:44:35 +01:00
Daniel Marjamäki bd41b3d713 Clang import; Fixed function arguments in SymbolDatabase 2020-01-13 05:52:46 +01:00
Daniel Marjamäki 9f3df5d630 Clang import; CompoundAssignOperator 2020-01-12 18:41:46 +01:00
Daniel Marjamäki ae7ff940e6 Clang import; minor tweaks 2020-01-12 18:05:45 +01:00
Daniel Marjamäki 1e207e42c5 CppCheck: Try to handle '"' properly in split() 2020-01-12 17:13:26 +01:00
Daniel Marjamäki f4f4377fbf Clang import; Constructor arguments, ExprWithCleanups 2020-01-12 16:49:02 +01:00
Daniel Marjamäki 47e186864b Clang import; Set function pointer properly 2020-01-12 15:15:21 +01:00
Daniel Marjamäki fd1809590c Token: Write function() in ast debug output 2020-01-12 15:04:25 +01:00
Daniel Marjamäki 0e75f16510 verificationUninit: ignore bailout values until it's less noisy 2020-01-12 14:52:15 +01:00
Daniel Marjamäki 1bad69923c astyle formatting
[ci skip]
2020-01-12 13:35:39 +01:00
Daniel Marjamäki 166402b5cf verificationUninit: Avoid some false positives for 'bailout' values 2020-01-12 13:35:09 +01:00
Daniel Marjamäki 88429382b7 Verification; Avoid obvious verificationUninit false positives during bailout 2020-01-12 11:53:49 +01:00
Daniel Marjamäki 55ea06354b ExprEngine: BailoutValue is uninitialized 2020-01-12 10:42:20 +01:00
Daniel Marjamäki e78438e990 astyle formatting
[ci skip]
2020-01-12 10:32:47 +01:00
Daniel Marjamäki 7704f6578f Verification; Fix struct member false negative 2020-01-12 10:29:03 +01:00
Rikard Falkeborn c6e74f4c10 Mathlib: Fix value of suffixed binary integer literal (#2487) 2020-01-12 08:11:12 +01:00
Daniel Marjamäki 668212ac2f SymbolDatabase: Type lookup for clang type strings 2020-01-11 21:24:15 +01:00
Daniel Marjamäki cde757bcd3 Clang import; Type fixes 2020-01-11 18:39:59 +01:00
Daniel Marjamäki abc51afcf1 Clang import; parse clang ast type with ValueType::parseDecl 2020-01-11 18:07:57 +01:00
Daniel Marjamäki ba244be2d6 Clang import; getType() 2020-01-11 16:49:30 +01:00
Daniel Marjamäki aa090a8b45 Clang import; addTypeTokens for function return type 2020-01-11 16:40:22 +01:00
Daniel Marjamäki f7f5f10de4 Clang import; Tweaked IfStmt (Clang 3.8 compatibility) 2020-01-11 16:15:18 +01:00
Daniel Marjamäki 05a34142aa Clang import; forward class declaration 2020-01-11 16:02:25 +01:00
Daniel Marjamäki 380cc78077 Clang; Run ValueFlow 2020-01-11 14:00:41 +01:00
Daniel Marjamäki 6b983a9587 Revert ValueFlow changes, there was unexpected problems in testrunner 2020-01-11 13:11:19 +01:00
Daniel Marjamäki 052eaba632 Clang; run ValueFlow analysis 2020-01-11 13:04:51 +01:00
Daniel Marjamäki 9c38a659a1 Clang import; Fixed CXXConstructExpr without child 2020-01-11 12:16:48 +01:00
Daniel Marjamäki 96ff57e275 ValueFlow; Refactoring 2020-01-11 09:17:32 +01:00
Daniel Marjamäki 30bc67c691 Clang import; CXXNullPtrLiteralExpr 2020-01-10 19:01:33 +01:00
Daniel Marjamäki 7a3bedb583 Clang import; CXXConstructExpr 2020-01-10 18:54:28 +01:00
Daniel Marjamäki c23d33fc0a Clang import; Fixed getSpelling() and getType() 2020-01-10 18:13:47 +01:00
Daniel Marjamäki f667abacf6 Clang import; character literal '\' 2020-01-10 17:37:36 +01:00
Daniel Marjamäki 4c778e0999 Clang import; Rename files/namespace 2020-01-10 16:29:06 +01:00
Daniel Marjamäki 8f1a50ffc0 Clang import; CStyleCastExpr 2020-01-10 16:19:01 +01:00
Daniel Marjamäki 75fd4809e6 Fix compiler warning 2020-01-10 15:08:53 +01:00
Daniel Marjamäki 797ed88147 Fix Cppcheck warning 2020-01-10 15:04:07 +01:00
Daniel Marjamäki 729fca8728 Clang import; handle locations better, only expand function bodies in source file 2020-01-10 14:59:34 +01:00
Daniel Marjamäki e7e80a574d Clang import; types 2020-01-10 12:13:50 +01:00
Daniel Marjamäki d0c1674fe6 Clang import; Fix in splitString 2020-01-10 11:40:28 +01:00
Daniel Marjamäki 4ed7178d4d Clang import; bug fixing in addTypeTokens 2020-01-10 11:32:54 +01:00
Daniel Marjamäki a0a2eae1d2 Clang import; cxxStaticCastExpr2 2020-01-10 11:04:51 +01:00
fuzzelhjb fcd5cda97f Check selected files from project (#2378) 2020-01-10 08:57:37 +01:00
Daniel Marjamäki 3db6502fba Verification; Dangerous casting of void pointer 2020-01-09 21:25:23 +01:00
Daniel Marjamäki b8aa71bc87 Clang import; CXXStaticCast 2020-01-09 20:53:06 +01:00
Daniel Marjamäki bf62138237 Verification; Remove VERIFY_UNINIT define, the checking is always compiled from now on 2020-01-09 20:25:52 +01:00
Daniel Marjamäki 35a8cd8418 Verification; fix division by zero false negative when value might be uninitialized 2020-01-09 19:40:15 +01:00
Daniel Marjamäki 34a26c7dd7 Clang import; Pass include paths to clang 2020-01-09 19:15:01 +01:00
Daniel Marjamäki ae5dbe0575 Clang import; UnaryOperator 2020-01-09 19:07:14 +01:00
Daniel Marjamäki 84b4f0f6ab Verification; Fixed false negative when global variable is changed by function call 2020-01-09 18:50:29 +01:00
Daniel Marjamäki 2137f1ead9 Clang import; reference before declaration 2020-01-09 18:03:24 +01:00
Daniel Marjamäki d842f00aef Clang import; UnaryExprOrTypeTraitExpr 2020-01-09 17:31:46 +01:00
Daniel Marjamäki 7daa1bc11d Clang import: CharacterLiteral 2020-01-09 16:54:45 +01:00
Daniel Marjamäki fea981211e Clang import; CXXBoolLiteralExpr 2020-01-09 16:19:38 +01:00
Daniel Marjamäki e6b873b7b9 Clang import; CXXOperatorCallExpr 2020-01-09 15:59:22 +01:00
Daniel Marjamäki 98e700e30d Clang import; Tweaks 2020-01-09 14:13:39 +01:00
Daniel Marjamäki 90e7a94ff4 Clang importer; Allow throw 2020-01-09 13:58:14 +01:00
Daniel Marjamäki a9dbf129f0 Clang import; some small tweaks 2020-01-09 13:52:17 +01:00
Daniel Marjamäki 64612bf93e Clang import; robustness 2020-01-09 13:40:38 +01:00
Daniel Marjamäki 060c695f80 Clang import; CXXConstructorDecl, CXXThisExpr 2020-01-09 13:19:14 +01:00
Daniel Marjamäki 1589ac5352 Clang import; Set links properly 2020-01-09 12:42:29 +01:00
Daniel Marjamäki 1be41cb8fb Clang import; in AstNode::dumpAst print <<<<NULL>>>> 2020-01-09 11:04:30 +01:00
Daniel Marjamäki 3d2d4c5cbd Clang import; Tweaks 2020-01-09 10:49:47 +01:00
Ken-Patrick Lehrmann 0b7649ca9b Fix 9298 (#2476)
* Fix 9298

Tell cppcheck that strcpy returns its first argument, and use that
knowledge in checkTokenInsideExpression.

* Add missing unit tests in cmake
2020-01-09 08:47:36 +01:00
Maksim Derbasov 872d531568 Removing check hidingInheritedPublic (#2482) 2020-01-09 06:53:08 +01:00
Daniel Marjamäki 4e8a922e18 Clang import; CXXMemberCall 2020-01-08 21:49:23 +01:00
Daniel Marjamäki 3387ee3512 Clang import; ClassTemplateDecl 2020-01-08 21:31:06 +01:00
Daniel Marjamäki eb3270959e Clang import; FunctionTemplateDecl 2020-01-08 20:47:52 +01:00
Daniel Marjamäki 27be51cb49 Clang importer; FieldDecl in CXXRecordDecl 2020-01-08 19:43:01 +01:00
Daniel Marjamäki 64953f36b3 Clang import: CXXRecordDecl, CXXMethodDecl 2020-01-08 19:32:04 +01:00
Daniel Marjamäki 5ffd6d744c Clang import; fix Cppcheck warnings about unused variables 2020-01-08 18:55:28 +01:00
Daniel Marjamäki 54a9b61329 Clang import; NamespaceDecl, varDecl4, varDecl5 2020-01-08 18:23:40 +01:00
Daniel Marjamäki b8ae957365 Clang import; fwrite FunctionDecl 2020-01-08 16:42:21 +01:00
Daniel Marjamäki c4c929a6a7 Clang import: StringLiteral, funcdecl3, determine includes with clang -v 2020-01-08 16:36:51 +01:00
Daniel Marjamäki f51048e03b Clang Import; TypedefDecl 2020-01-08 14:25:09 +01:00
Daniel Marjamäki e6ee29fd11 Clang import; BreakStmt, ContinueStmt 2020-01-08 12:29:54 +01:00
Daniel Marjamäki ea414e46e1 Clang import; WhileStmt 2020-01-08 12:19:48 +01:00
Daniel Marjamäki 61039023b2 Clang import; ForStmt 2020-01-08 10:35:44 +01:00
Daniel Marjamäki 4b7e6c68b0 Clang import; MemberExpr 2020-01-08 09:51:35 +01:00
Daniel Marjamäki d75d9c1866 Clang import; Refactoring 2020-01-07 19:51:44 +01:00
Daniel Marjamäki e5b99d3299 Clang import; Refactoring 2020-01-07 19:47:06 +01:00
Daniel Marjamäki a3abc75ca1 Clang import; RecordDecl 2020-01-07 18:33:24 +01:00
Daniel Marjamäki c4131bbc5b Clang import; else 2020-01-07 12:38:37 +01:00
Daniel Marjamäki b829c4cebb Clang import; Arrays 2020-01-07 12:19:06 +01:00
Daniel Marjamäki 2760d4400b SymbolDatabase: Ensure parameter name is same 2020-01-06 18:56:01 +01:00
Daniel Marjamäki 6a4a59b783 Clang Import; Added test 2020-01-06 16:45:18 +01:00
Daniel Marjamäki 28688dcc09 Clang Import; set Token::function() 2020-01-06 15:26:21 +01:00
Daniel Marjamäki 8ea22edb4e Clang Import; VarDecl 2020-01-06 13:47:19 +01:00
Daniel Marjamäki 00c05ce626 Clang import; CallExpr, setLocation 2020-01-06 09:05:39 +01:00
Ken-Patrick Lehrmann b6d2c1b238 Fix github CI (#2477)
* Fix github CI

```
Checking lib/check.cpp: __CPPCHECK__=1...
lib/symboldatabase.h:719:5: warning: Class 'Function' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
    Function(const Token *tokenDef);
    ^

Checking lib/templatesimplifier.cpp: __CPPCHECK__=1...
lib/symboldatabase.cpp:1754:33: warning: Condition 'settings' is always true [knownConditionTrueFalse]
    const Library * const lib = settings ? &settings->library : nullptr;
                                ^
lib/symboldatabase.cpp:1751:9: note: Assuming that condition '!settings' is not redundant
    if (!settings)
        ^
lib/symboldatabase.cpp:1754:33: note: Condition 'settings' is always true
    const Library * const lib = settings ? &settings->library : nullptr;
```

* Compile parseClangAstDump
2020-01-05 21:10:48 +01:00
Daniel Marjamäki 07cc3e47c4 cppcheck.vcxproj: Try to make appveyor happy 2020-01-05 19:34:25 +01:00
Daniel Marjamäki 0b765cd253 Clang importing; Use ValueFlow 2020-01-05 19:21:13 +01:00
Daniel Marjamäki fa727185e5 Clang import; IfStmt 2020-01-05 19:18:32 +01:00
amai2012 b621c35539 Astyle formatting [ci skip] 2020-01-05 17:00:34 +01:00
Daniel Marjamäki 211af1d4fe Clang import: debug output 2020-01-05 16:58:13 +01:00
Paul Fultz II 90f82d0374 Fix issue 9541: false negative: knownConditionTrueFalse (#2473)
* Fix issue 9541: false negative: knownConditionTrueFalse

* Add another test case

* Add another test

* Fix FPs

* Format

* Fix compile error

* Remove double conditions

* Fix compile error
2020-01-05 16:25:33 +01:00
Ken-Patrick Lehrmann 5f73e1cb32 Fix 9546: properly check that the bound is the size (#2475)
Previously, as the check was done on the token and not on the ast,
`i <= v.size()` and `i <= v.size() - 2` would both raise the same
warning.

This patch fixes this, but this mean the check is only done when the
condition if `i <= v.size()`. Any other (more complex) condition is
ignore, and so we have false negative for instance with
 `i <= v.size() + 1`.
2020-01-05 16:24:25 +01:00
Daniel Marjamäki bc17b9a1be Importing Clang ast dump: Run ValueFlow analysis 2020-01-05 16:23:02 +01:00
Daniel Marjamäki b03bdfaf72 Import Clang ast dump (experimental) 2020-01-05 15:12:53 +01:00
Maksim Derbasov a3ed9116e5 Clarify error msg for hidingInheritedPublic (#2474) 2020-01-05 09:32:39 +01:00
Daniel Marjamäki 4f1e8bc5e7 astyle formatting
[ci skip]
2020-01-04 18:47:05 +01:00
Paul Fultz II e1a97c524d Fix issue 9554: False positive: The address of local variable 'x' is accessed at non-zero index. (#2470)
* Fix issue 9554: False positive: The address of local variable 'x' is accessed at non-zero index.

* Format

* Remove unnecesary condition check
2020-01-04 11:39:52 +01:00
Ken-Patrick Lehrmann a9d423eef2 Fix #8938: FP identicalInnerCondition (#2471) 2020-01-04 11:38:56 +01:00
Ken-Patrick Lehrmann eca7ee9260 9356: Prevent false positive when passing non-const reference to member constructor (#2370)
* Add cases for 9356

* 9356: Prevent false positive when passing non-const reference to member constructor

This workarounds false positives 'Parameter  can be declared with const [constParameter]'
when said parameter is used in constructor call. It assume the
constructor call might change the parameter (without any checks.
The drawback is that we have false negative, in cases where we could
check the constructor actually takes a const reference, or a copied by
value parameter.

* Add todo comment in isVariableMutableInInitializer
2020-01-04 11:36:45 +01:00
Paul Fultz II e07801a891 Fix issue 9563: new daca crash: findLambdaEndToken not finding end token (#2472) 2020-01-04 10:45:24 +01:00
orbitcowboy 1e0f8ae9b4 Running astyle [ci skip]. 2020-01-04 00:06:27 +01:00
Paul Fultz II dd05839a7e Fix false positives in knownConditionTrueFalse when using expressions with const variables (#2469) 2020-01-03 19:35:28 +01:00
Daniel Marjamäki 0e369edd8c Verification; Only warn about uninitialized function arguments if VERIFY_UNINIT is defined 2020-01-02 06:16:36 +01:00
Daniel Marjamäki e32c01b13c Verification; printing debug output on std::cout 2020-01-01 19:57:49 +01:00
Maksim Derbasov fc5fd3c40c Check that virtual function non-narrow access modifier in derived class (#2229)
* Check that virtual function has not narrowed access in derived class

* motivation info added

* error reporting moved to func

* added suppression for CI
2020-01-01 16:09:43 +01:00
Rikard Falkeborn 7514544d94 Fix #8758 (add syntax error for invalid code) (#2466) 2020-01-01 15:46:09 +01:00
Daniel Marjamäki f23d880a7e Verification; use <uninit> configuration 2020-01-01 14:37:20 +01:00
Paul Fultz II 30b9455e89 Fix issue 9556: FP mismatchingContainers: raw pointer comparison (#2465)
* Fix issue 9556: FP mismatchingContainers: raw pointer comparison

* Formatting
2020-01-01 12:02:21 +01:00
Daniel Marjamäki b44029cdaa Refactoring; CWEs should be clarified 2020-01-01 09:09:10 +01:00
Daniel Marjamäki 28c37bb63f Verification; Clarify error message 2020-01-01 08:36:40 +01:00
Daniel Marjamäki 443e8cfbcf Verification; avoid false positive for known float value 2020-01-01 08:33:27 +01:00
Daniel Marjamäki d4ec8075a4 Verification; Fix false positive in while loops 2019-12-31 22:32:16 +01:00
Daniel Marjamäki 043634be27 Verification; Better handling of assignment in while 2019-12-31 20:31:31 +01:00
Daniel Marjamäki 446256a503 Verification; assume non-const pointer argument might point at uninitialized data 2019-12-31 17:51:58 +01:00
Daniel Marjamäki 10010eba95 Verification; Avoid fp for array declaration 2019-12-31 16:50:20 +01:00
Dmitry-Me 1a2b770bfd Break the loop once a match is found 2019-12-31 18:32:45 +03:00
Dmitry-Me 895910b769 Fixed #7159 (wrong handling of function parameters) 2019-12-31 18:26:12 +03:00
Daniel Marjamäki f55d72e821 Verification; uninitialized local variable 2019-12-31 14:57:42 +01:00
Daniel Marjamäki 48be067dd1 Verification; Added --verify-diff option 2019-12-31 12:05:08 +01:00
Daniel Marjamäki 3af3219076 Verification; Juliet *_float_* division by zero tests 2019-12-31 09:02:06 +01:00
Paul Fultz II 82c91f9484 Fix issue 9550: False positive: Same iterator is used with containers 'x' that are defined in different scopes (#2463) 2019-12-31 08:09:04 +01:00
Daniel Marjamäki fde86b696d Verification; Use ValueFlow for improved accuracy 2019-12-31 05:59:06 +01:00
Daniel Marjamäki 3ff31b799c Verification: Use separate id for floating point division by zero 2019-12-30 19:50:22 +01:00
Daniel Marjamäki 4b5585e75b Verification; floating point division by zero 2019-12-30 19:47:18 +01:00
Daniel Marjamäki a60efa6774 Verification; Experimental checking for uninit 2019-12-30 18:55:16 +01:00
Daniel Marjamäki 6ea1875a84 Verification; Ensure assertions for variable type limits are added 2019-12-30 12:53:59 +01:00
Daniel Marjamäki d247ffb13a Fix compiler warning 2019-12-29 21:22:20 +01:00
Daniel Marjamäki 29b599b0e5 Verification; callbacks in executeCast 2019-12-29 19:17:36 +01:00
Daniel Marjamäki 9723b28385 Verification; struct pointer member 2019-12-29 18:42:35 +01:00
Daniel Marjamäki 2710a94b4b Verification; Merged handling of pointers and arrays 2019-12-29 16:26:11 +01:00
Paul Fultz II 75de485c4d Fix issue 9551: Out-of-bounds in getLifetimeTokens() (#2461) 2019-12-29 08:23:58 +01:00
Daniel Marjamäki d16ea3293e Verification; Fix testing 2019-12-28 22:09:16 +01:00
Daniel Marjamäki ab2e87191f Verification; Avoid crash 2019-12-27 20:27:21 +01:00