Commit Graph

13148 Commits

Author SHA1 Message Date
Daniel Marjamäki f31fbba54a Token::typeDecl: Fix endless recursion for code:
void f()
{
  auto val = val;
}

I did not manage to pinpoint a good location to put a unit test. However this will be tested when daca@home runs the package gcc-avr.
2021-08-26 19:03:35 +02:00
Paul Fultz II 1cd9d0479d
Fix 10433: assertion failure in ValueFlow (Interval::fromValues) (#3419) 2021-08-26 07:46:40 +02:00
Paul Fultz II 8aa37218c2
Fix 10400: FP nullPointer - for loop condition (#3417) 2021-08-25 20:33:41 +02:00
Daniel Marjamäki 11916171fe Fix crash in programmemory, crash found in daca@home package system-root 2021-08-25 06:56:19 +02:00
Paul Fultz II f7ddd7a35d
Fix 10430: FP knownConditionTrueFalse with bool from unsigned char (#3416) 2021-08-25 04:51:54 +02:00
Paul Fultz II 8ddc5764f8
Fix 10425: False positive: returnDanglingLifetime when taking address of captured variable (#3415) 2021-08-25 04:06:03 +02:00
Daniel Marjamäki 37ef29889b Fix 10424: ExpressionAnalyzer assertion failure in librevisa 2021-08-24 16:06:51 +02:00
Paul Fultz II 524db1c756
Fix 10420: assertion error when analysing juce (#3413) 2021-08-23 11:12:42 +02:00
Paul Fultz II 865163b2ba
Add library configurations for free functions like std::size, std::empty, etc (#3410) 2021-08-23 09:03:48 +02:00
Daniel Marjamäki 165d48c846 fix gcc compiler warnings 2021-08-22 18:06:54 +02:00
Daniel Marjamäki db57efa486 CheckBufferOverrun: Reimplement CheckBufferOverrun::argumentSize check 2021-08-22 16:37:41 +02:00
chrchr-github ee4d90b4fa
Refactor: fix member shadowing, return by const ref (#3407) 2021-08-21 22:00:45 +02:00
Paul Fultz II a0c37ceba2
Fix FP: Set correct bounds for interval (#3411) 2021-08-21 21:17:05 +02:00
Paul Fultz II d30f42e0da
Fix FP when calling a function in a condition (#3412) 2021-08-21 18:52:11 +02:00
Daniel Marjamäki ca50dea97d Fix in Tokenizer::simplifyUsing for non-scopes 2021-08-21 10:10:40 +02:00
Daniel Marjamäki d73ab0ad96 Tokenizer::simplifyUsing; Fixed bug when enum class is used 2021-08-20 16:08:01 +02:00
Paul Fultz II e62cdbb664
Deduce symbolic values from conditions (#3406) 2021-08-19 22:01:55 +02:00
Paul Fultz II e0de48bb1d
Fix 7524: ValueFlow: false path for 'x<3' (#3393) 2021-08-16 09:19:07 +02:00
Daniel Marjamäki 6a565f9e2f cleanup unused function 2021-08-15 11:01:14 +02:00
Paul Fultz II be978b35cf
Add more ValueFlow info in the xml dumps (#3402) 2021-08-15 08:02:31 +02:00
Daniel Marjamäki 83270a6c52 Fixed #10376 (Cppcheck does not add some function arguments to the dump file) 2021-08-15 07:48:01 +02:00
Paul Fultz II f81ddd2daa
Fix 10408: FP nullPointer on 'return x.release()' (#3404) 2021-08-15 07:43:50 +02:00
Paul Fultz II 422e411b6c
Fix 9444: Syntax error on valid C++14 code (#3403) 2021-08-15 07:43:02 +02:00
Paul Fultz II 6d65f86871
Fix 9245: Synax error on valid C++14 code: AST broken, binary operator '=' doesn't have two operands. (#3400) 2021-08-14 22:50:58 +02:00
Paul Fultz II c92dab1329
Fix 10406: FP danglingLifetime with pointer-to-pointer (#3401) 2021-08-14 21:37:17 +02:00
Paul Fultz II 818fd248e1
Simplify template keyword bracket (#3399) 2021-08-14 21:16:27 +02:00
Paul Fultz II fdaeaacc40
Symboldatabase: Improve valuetypes for containers, iterators, and smart pointers (#3398) 2021-08-14 19:00:58 +02:00
Paul Fultz II f946bbc249
Only add exprids to expression and not variable declarations (#3397) 2021-08-14 06:49:12 +02:00
Paul Fultz II b9ac48c90a
Fix 10409: FP 'Condition 's.size()<3' is always false' (#3396) 2021-08-14 06:48:38 +02:00
Paul Fultz II 2a3657154b
Dont require __main__ for an addon (#3363) 2021-08-12 20:17:51 +02:00
Paul Fultz II 69eaa9dfd9
Refactor: ConditionHandler cleanup (#3394) 2021-08-11 08:37:37 +02:00
chrchr-github e626e3065d
Fix MSVC warning: member shadowing (#3392) 2021-08-10 22:34:13 +02:00
Daniel Marjamäki e95395e5f0 Fixed #10397 (FP constParameter - implementing an interface) 2021-08-10 15:37:59 +02:00
Daniel Marjamäki c2305b1da7 Fixed #10396 (FP missingReturn on void operator=()) 2021-08-10 09:55:16 +02:00
Daniel Marjamäki d0b6079a83 Fixed #10372 (Confusing message for compareValueOutOfTypeRangeError) 2021-08-10 09:38:28 +02:00
Daniel Marjamäki 0093452bed SymbolDatabase; Better handling of namespace that is defined in several scopes 2021-08-10 07:00:11 +02:00
Paul Fultz II 0f897acecd
Fix FP in solveExpr when using symbolic values (#3391) 2021-08-09 20:41:10 +02:00
Daniel Marjamäki d82df7cc55 Fix self-check warning, condition is always true 2021-08-09 13:17:48 +02:00
Daniel Marjamäki 0cb6603055 SymbolDatabase; Use range based for loops 2021-08-09 12:43:21 +02:00
Alfi Maulana aab5b39e2d
feat: add support for .ipp and .ixx extensions (#3383) 2021-08-09 10:46:56 +02:00
Daniel Marjamäki 94e8a69a9b Fix self-check warning 2021-08-09 09:55:24 +02:00
Paul Fultz II a218ea3b23
Fix 10404: FP knownConditionTrueFalse after subtraction (#3390) 2021-08-09 07:45:41 +02:00
Daniel Marjamäki 5f81b03df1 valueflow; Remove unused function, fixing gcc warning 2021-08-08 21:25:47 +02:00
Daniel Marjamäki fa398a6ba1 valueflow: remove not needed INDENT-OFF and INDENT-ON 2021-08-08 21:22:42 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki b729c4a126 ctu: fixes for xml output 2021-08-06 07:57:18 +02:00
Daniel Marjamäki 27a4df06d2 Revert "SymbolDatabase; First fix to handle when a namespace have many scopes"
This reverts commit e6cc7201b0.
2021-08-04 22:30:39 +02:00
Daniel Marjamäki ad478914f7 cppcheck build dir; Fix several xml syntax errors in the analyzer info files 2021-08-04 21:39:24 +02:00
Paul Fultz II 735f716603
Fix 10394 and 10395: FP knownConditionTrueFalse: loop variable (#3381) 2021-08-04 21:07:55 +02:00
Paul Fultz II 8b8ae55490
Fix 10129: false negative: knownConditionTrueFalse (#3382)
* Add symbolic matching

* Check for truncated values

* Dont propagate uninit values

* Update errorpath test

* Add test case for 10129

* Add test case for FP

* Remove symbolic values that are the same as the token

* Fix test messages

* Fix cppcheck issue

* Format
2021-08-04 21:07:31 +02:00
Daniel Marjamäki e6cc7201b0 SymbolDatabase; First fix to handle when a namespace have many scopes 2021-08-04 20:36:43 +02:00
Paul Fultz II 4626f9ed76
Fix FP when returning a pointer to a container (#3379) 2021-08-04 08:16:31 +02:00
chrchr-github 28c8b00e5c
Minor: fix MSVC shadow warning (#3376) 2021-08-04 08:16:02 +02:00
Paul Fultz II 6736ac7e3a
Revert "Formatted the code [ci skip]" (#3380)
This reverts commit 7a6d7f7c2d.
2021-08-03 17:53:30 +02:00
orbitcowboy 7a6d7f7c2d Formatted the code [ci skip] 2021-08-03 06:33:54 +02:00
Paul Fultz II 08041e3a0b
Refactor: Assert an expression has an id and fix assertion failures (#3377)
* Fix 10390: FP: knownConditionTrueFalse

* Assert expression has an ID

* Fix assertion errors

* Format
2021-08-03 06:31:52 +02:00
Paul Fultz II 7be9b217e6
Fix 7843 and 7844: ValueFlow for abs (#3373)
* Refactor: Use valueFlowForward to forward values in condition expression

* Formattting

* Make known when using bools as well

* Set abs function as always positive

* Add test

* Add valueFlowSymbolicAbs

* Set impossible values

* Fix test case

* Fix error messages

* Merge
2021-08-03 06:31:28 +02:00
Paul Fultz II 3d19b33c3e
Fix 9948 and 10234: false negative: knownConditionTrueFalse and stlOutOfBounds (#3372) 2021-08-02 10:51:34 +02:00
Paul Fultz II 61ceff39f5
Fix 10390: FP: knownConditionTrueFalse (#3374) 2021-08-02 10:49:39 +02:00
Daniel Marjamäki 0f0d042ee2 Refactoring; Use range for in SymbolDatabase 2021-08-01 21:51:37 +02:00
Daniel Marjamäki 1ec7397c21 astyle formatting
[ci skip]
2021-08-01 14:05:30 +02:00
Robert Reif 94dc6c2c3f
fix #10332 (cppcheck crashes) (#3371) 2021-08-01 10:31:36 +02:00
Paul Fultz II 2f6a6e4b45
Refactor: Use valueFlowForward to forward values in condition expression (#3369) 2021-08-01 10:13:14 +02:00
Paul Fultz II 7d9fdf582b
Fix 10121: False positive: Condition 'ab->a!=123' is always false when modifying an alias (#3293) 2021-08-01 10:10:11 +02:00
Paul Fultz II 6767b57d4c
Fix FP for symbolic values when the expression is not const (#3370) 2021-07-31 14:19:37 +02:00
Paul Fultz II 3a7ba3cd29
Add symbolic values to ValueFlow (#3367) 2021-07-30 21:29:35 +02:00
Paul Fultz II 6a81b4c17c
Fix 10264: FP invalidContainer when address of container is passed inside struct (#3368) 2021-07-30 15:52:00 +02:00
Paul Fultz II 737b6199ba
Refactor: Allow parse to return multiple values for a condition (#3361) 2021-07-26 22:23:19 +02:00
Paul Fultz II c34691ff56
Fix 10354: FP knownConditionTrueFalse after bitwise and/xor (#3360) 2021-07-26 22:22:50 +02:00
Paul Fultz II 0d3afbb954
Evaluate casts in programmemory (#3359) 2021-07-26 22:22:23 +02:00
Paul Fultz II 14802b932e
Fix 10362: ValueFlow: global variable might be modified by function call (#3358) 2021-07-26 22:21:56 +02:00
orbitcowboy c14bb9cd2e Running astyle [ci skip] 2021-07-26 16:32:00 +02:00
Paul Fultz II 84ea0a2295
Refactor: Remove extra analysis of container sizes in conditions (#3357) 2021-07-25 18:14:51 +02:00
Paul Fultz II 5be3f700bb
Fix 10373: ValueFlow: container in struct assumed empty (#3355) 2021-07-25 18:13:55 +02:00
Paul Fultz II 8e416a7255
Fix issue 10379: FP knownConditionTrueFalse with mod operator (#3354) 2021-07-25 18:13:14 +02:00
Paul Fultz II f9516cf1c6
Fix issue 10378: FP derefInvalidIteratorRedundantCheck (#3353) 2021-07-24 22:44:18 +02:00
Georgiy Komarov 48031ffb3b
lib: Fix clang -Wrange-loop-construct warning (#3347) 2021-07-22 18:53:44 +02:00
Daniel Marjamäki 74ab8f1a48 misra; implemented rule 20.8 2021-07-22 08:46:28 +02:00
Paul Fultz II 00eb71fd49
Remove constexpr -> const simplification (#3346) 2021-07-22 07:22:26 +02:00
Daniel Marjamäki b1547a387e astyle formatting
[ci skip]
2021-07-21 20:13:38 +02:00
Paul Fultz II 41c94b656a
Fix FP const pointer with class variable and add more tests (#3345) 2021-07-21 07:36:13 +02:00
Paul Fultz II 8efe1d4ab4
Find reference to dangling unique ptr (#3344) 2021-07-20 21:30:27 +02:00
Daniel Marjamäki 524e4b8c96 CI; Fix self check warning, pointer can be const 2021-07-20 12:21:01 +02:00
Daniel Marjamäki dd34d1c123 CI; Fix Cppcheck self-check, pointer can be const 2021-07-20 11:21:47 +02:00
Daniel Marjamäki fb5ab5e439 constPointer; Improved checking dereferenced pointer is used in calculation/comparison 2021-07-20 10:38:38 +02:00
Daniel Marjamäki 4d23c02320 constPointer; Improved checking when pointer is not dereferenced 2021-07-20 10:28:35 +02:00
Daniel Marjamäki d1fe34e167 misra; implement rule 8.10 2021-07-18 21:18:07 +02:00
Daniel Marjamäki f6efd8c6be CI; Fix self check false positive 2021-07-18 20:00:20 +02:00
Daniel Marjamäki ae79b4759d CI; Fix self check false positives 2021-07-18 19:31:19 +02:00
Daniel Marjamäki 9362c1fc6c missing return; write inconclusive error if function ends with unknown function-like macro 2021-07-18 16:00:42 +02:00
Daniel Marjamäki 02682ab17d missing return; Fixed FP when function ends with assert(0) 2021-07-18 14:54:25 +02:00
Daniel Marjamäki eb9a251a4c const variables/parameters; Improved check to handle pointers also (misra 8.13) 2021-07-18 10:59:52 +02:00
orbitcowboy 1be5bb8bbc Running astyle [ci skip] 2021-07-18 10:01:22 +02:00
Paul Fultz II 0b079937e0
Fix 10364: Performance regression (#3340) 2021-07-18 07:48:21 +02:00
Paul Fultz II 59a1c1a9d8
Refactor: Remove variable analyzer (#3339) 2021-07-18 07:46:31 +02:00
orbitcowboy 3f1e937ea1 Running astyle [ci skip] 2021-07-17 08:19:04 +02:00
chrchr-github 8cd8b9c64e
Fix MSVC build and some warnings (#3334) 2021-07-16 21:55:12 +02:00
Daniel Marjamäki 797de4ef92 Fixed #10363 (FP: compareValueOutOfTypeRangeError) 2021-07-16 19:08:08 +02:00
Pavel Šimovec c71e2da5a8
Remove a false positive - main function has no return value (#3335) 2021-07-16 18:50:16 +02:00
Paul Fultz II 942202aede
Evaluate container sizes in forward analysis (#3338) 2021-07-16 18:49:07 +02:00