Commit Graph

14093 Commits

Author SHA1 Message Date
gerboengels 63e30d1b8c
Fix syntaxError on lambda inside decltype (#4650)
Use case where it gave an issue:

using customComparator = decltype([] (const X& lhs, const X& rhs) { return lhs.CompareTo(rhs); });
std::map<X, int, costomComparator> m;

Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
2022-12-18 16:46:04 +01:00
Daniel Marjamäki 7799f820a3 Refactoring: Use static for local function getMinMaxValues 2022-12-17 21:21:18 +01:00
Daniel Marjamäki c736d60642 Fix Misra C++ warning 'Limited dependence should be placed on C++ operator precedence rules in expressions.' 2022-12-17 20:45:58 +01:00
chrchr-github 4c8aa56d8b
Partial fix for #11378 internalAstError regressions (iscpp11init) (#4629)
* Partial fix for #11378 internalAstError regressions (iscpp11init)

* Use %cop%

* Add test for #11229

* Format

* Format
2022-12-16 10:46:15 +01:00
Paul Fultz II 9c55b933c1
Partial fix for 11303: False negative: knownConditionTrueFalse using container .back() (#4633)
* Partial fix for 11303: False negative: knownConditionTrueFalse using container .back()

* Format

* Fix error message
2022-12-15 18:35:19 +01:00
Paul Fultz II 90898945c1
Fix 10532: False negative: dangling string_view when using ternary operator (#4638)
* Fix 10532: False negative: dangling string_view when using ternary operator

* Format

* Update
2022-12-15 18:34:43 +01:00
chrchr-github 553b579f8d
Fix #11434 FP knownConditionTrueFalse with loop over bool array (#4646)
* Fix #11434 FP knownConditionTrueFalse with loop over bool array

* Simplify
2022-12-15 14:31:02 +01:00
chrchr-github 0c1e2ceeb9
Fix #11289 FP wrongPrintfScanfArgNum - snprintf with parameter pack (#4644) 2022-12-15 08:52:13 +01:00
chrchr-github b7693ccc7a
Fix #11431 FP resourceLeak with goto (#4645) 2022-12-14 22:47:14 +01:00
Oliver Stöneberg 29e0133cb5
extracted `FwdAnalysis` from `astutils.{cpp|h}` (#4637)
* added missing filtering offiles in Visual Studio project

* extracted `FwdAnalysis` from `astutils.{cpp|h}`
2022-12-13 22:29:23 +01:00
Paul Fultz II e2f398f81a
Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) ) (#4636)
* Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) )

* Format
2022-12-13 07:52:58 +01:00
Oliver Stöneberg e01c463ff8
fixed #11428 - improved handling of suffixes in `MathLib::to{Double|ULong|Long}Number()` (#4635)
* fixed #11428 - improved handling of suffices in `MathLib::to{Double|ULong|Long}Number()`

* testmathlib.cpp: adjustments for `libc++`

* mathlib.cpp: added TODO
2022-12-13 07:52:45 +01:00
Paul Fultz II b4d455df48
Fix 11349: FP negativeIndex for clamped array index (#4627)
* Fix 11349: FP negativeIndex for clamped array index

* Format

* Use emplace_back

* Use default constructor
2022-12-13 07:50:01 +01:00
chrchr-github 5b687cb038
Fix #11423 Crash in valueFlowForwardConst() (#4634) 2022-12-12 22:58:48 +01:00
chrchr-github 3f5054035d
Fix #11432 FP passedByValue for overriden function (#4632) 2022-12-12 21:52:58 +01:00
Daniel Marjamäki 7aae78fed3 Refactoring: Remove unused parameter for AnalyzerInfo::reportErr 2022-12-11 21:27:16 +01:00
Paul Fultz II 3f88744851
Fix 11358: FP containerOutOfBounds for container passed by pointer (#4626) 2022-12-09 19:43:21 +01:00
Oliver Stöneberg 40a69e5afb
optimized deserializing of `ErrorMessage` and related main process code (#4610) 2022-12-09 19:34:51 +01:00
Paul Fultz II 6eccb2e36c
Throw internal error when tokens are not in order (#4623)
* Throw internal error when tokens are not in order

* Add semicolon
2022-12-09 07:17:16 +01:00
Paul Fultz II 7acbb656f3
Fix 11412: False positive: uninitvar (#4624)
* Dont remove modified variables from dead code

* Add test for 11412

* Format
2022-12-09 07:15:47 +01:00
Paul Fultz II c150317f02
Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement (#4625)
* Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement

* Format
2022-12-09 07:15:15 +01:00
chrchr-github c779cefa61
Fix #11422 debug: Missing variable class for variable with varid (#4616) 2022-12-08 20:17:06 +01:00
Paul Fultz II 0cb742701d
Fix 11415: FP containerOutOfBounds for container initialized in virtual method (#4622) 2022-12-08 20:10:58 +01:00
chrchr-github 04b7c0c200
Fix #11404 FP knownConditionTrueFalse with iterator (#4619)
* Fix wrong value set in valueFlowSameExpressions()

* Fix  #11404 FP knownConditionTrueFalse with iterator
2022-12-08 10:40:55 +01:00
Paul Fultz II 663a8411dd
Fix 11416: FP nullPointerRedundantCheck for check after loop with break (#4620) 2022-12-08 07:27:06 +01:00
Oliver Stöneberg 4103d05c7f
improved `ErrorMessage::deserialize()` error messages (#4617) 2022-12-07 18:00:45 +01:00
chrchr-github 8713dabe58
Get type from iterator (#4613) 2022-12-07 09:38:36 +01:00
Oliver Stöneberg 8bb5ac0efd
improved `MathLib::to{ULong|Long|Double}Number()` and increased test coverage / added CMake option `USE_LIBCXX` / fixed #10695 (#4611) 2022-12-07 09:20:09 +01:00
chrchr-github 89dba226dd
Fix #11305 FP uninitvar with unseen typedef (#4612) 2022-12-07 09:14:22 +01:00
chrchr-github 0e57c27dd3
Fix #11386 debug: CheckClass::checkConst found unlinked template argument list (#4614) 2022-12-07 09:12:46 +01:00
chrchr-github d5d7446433
Add cfg for std::scoped_lock, handle template arguments in checkMisusedScopedObject() (#4615) 2022-12-07 09:10:48 +01:00
Oliver Stöneberg 7d3ce62ee9
improved errorhandling related to deserializing `ErrorMessage` (#4604) 2022-12-03 15:44:33 +01:00
chrchr-github 0854fda28a
Get type from smartpointer (#4608)
* Fix #11223 checkLibraryFunction treats "auto" as type

* Use utility function

* Get type from 'auto p = new ...'

* Fix merge

* Add test for recent fix

* Format

* Get type from smartpointer
2022-12-03 07:50:21 +01:00
chrchr-github 7d6683fb78
Fix #11417 FP knownConditionTrueFalse with container and brace init (#4606)
* Fix #11417 FP knownConditionTrueFalse with container and brace init

* Format

* Format

* Move to getInitListSize()
2022-12-02 22:07:08 +01:00
chrchr-github e4ee7cd59c
Get type from 'auto p = new ...' (#4607)
* Fix #11223 checkLibraryFunction treats "auto" as type

* Use utility function

* Get type from 'auto p = new ...'

* Fix merge
2022-12-02 20:28:14 +01:00
chrchr-github 9efedd6be9
Fix #11223 checkLibraryFunction treats "auto" as type (#4605)
* Fix #11223 checkLibraryFunction treats "auto" as type

* Use utility function
2022-12-02 07:21:33 +01:00
chrchr-github 428f5016d4
Partial fix for #11378 (iscpp11init) (#4595)
* Partial fix for #11378 (iscpp11init)

* Improve fix

* Add fix
2022-11-27 09:26:46 +01:00
chrchr-github 665e4230f2
Fix #11406 FP returnDanglingLifetime, std::unique_ptr and implicit conversion to bool (#4600) 2022-11-27 09:24:19 +01:00
chrchr-github 4cb49013a7
Fix #11374 FP danglingTemporaryLifetime with std::string_view (#4602) 2022-11-27 09:22:55 +01:00
Rikard Falkeborn 52264b9c26
Fix #11401 nullpointer dereference with alignof (#4601)
* checknullpointer: Don't report dereference with alignof

* Refactor unevaluating operator check in checknullpointer

Unifying these ensures the different checks treat the operators the
same.

* Fix FP with _Alignof and null pointer

Just like alignof, _Alignof does not evaluate its operand.

* CheckNullPointer: Also support compiler specific alignof

This fixes #11401 which is about __alignof__. For good measure, also add
the microsoft extensions __alignof and _alignof.
2022-11-27 09:20:19 +01:00
Rikard Falkeborn 8465d901c8
Fix 11396, doublefree on munmap in if-statement (#4594) 2022-11-26 15:45:27 +01:00
Stefan van Kessel a5c16af16d
Fix lambda capture template syntax error (#4593) 2022-11-23 20:15:10 +01:00
chrchr-github 68acd77053
Fix #11361 FP ctuPointerArith with unknown buffer size (#4591) 2022-11-23 19:11:47 +01:00
Daniel Marjamäki ad8c1e26f0 dump: output language to dumpfile 2022-11-20 12:30:09 +01:00
chrchr-github 9f50611a44
Fix #11391 FP doubleFree with goto (#4587) 2022-11-19 16:49:34 +01:00
chrchr-github 80aa6dc1d9
Fix #11392 FP mismatchAllocDealloc with std::unique_ptr and custom deleter (#4585) 2022-11-18 19:45:25 +01:00
gerboengels 3fdba645a6
Improve fix for #11383 FP selfAssignment: lambda capture (#4584) 2022-11-18 19:44:32 +01:00
chrchr-github 4ce76d0b58
Fix #11385 debug: SymbolDatabase::findFunction found '>' without link. (#4583) 2022-11-14 21:08:15 +01:00
chrchr-github e3939d32d0
Fix crash on nullptr (#4582)
* Update tokenlist.cpp

* Update testincompletestatement.cpp

* Fix #11370 FP constStatement with lambda

* Format

* Fix crash on nullptr

* Emit syntax error

* Fix test

* Use strAt()

* Fix another crash on nullptr

* Update testconstructors.cpp

* Fix crash on nullptr

* Fix test
2022-11-13 23:04:51 +01:00
chrchr-github 701d381895
Fix #11383 FP selfAssignment: lambda capture / #11380 FP operatorEqRetRefThis (#4581)
* Fix  #11383 FP selfAssignment: lambda capture /  #11380
FP operatorEqRetRefThis

* Format
2022-11-13 21:20:44 +01:00