Commit Graph

27121 Commits

Author SHA1 Message Date
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
Oliver Stöneberg e5721030ca
greatly sped up `dmake` ()
* dmake.cpp: use `endsWith()` in `getCppFiles()`

* dmake.cpp: optimized string concatenation in `getDeps()`

* dmake.cpp: avoid duplicated `std::string::find()` in `getDeps()`

* dmake.cpp: no need to get dependencies of headers without `.h` extension in `getDeps()`

* dmake.cpp: do not try to look for file in `externals` folder which does not contain any headers in `getDeps()`
2022-12-17 09:13:31 +01:00
chrchr-github 4c8aa56d8b
Partial fix for internalAstError regressions (iscpp11init) ()
* Partial fix for  internalAstError regressions (iscpp11init)

* Use %cop%

* Add test for 

* Format

* Format
2022-12-16 10:46:15 +01:00
Paul Fultz II 9c55b933c1
Partial fix for 11303: False negative: knownConditionTrueFalse using container .back() ()
* 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 ()
* 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 FP knownConditionTrueFalse with loop over bool array ()
* Fix  FP knownConditionTrueFalse with loop over bool array

* Simplify
2022-12-15 14:31:02 +01:00
chrchr-github 0c1e2ceeb9
Fix FP wrongPrintfScanfArgNum - snprintf with parameter pack () 2022-12-15 08:52:13 +01:00
chrchr-github b7693ccc7a
Fix FP resourceLeak with goto () 2022-12-14 22:47:14 +01:00
Oliver Stöneberg 29e0133cb5
extracted `FwdAnalysis` from `astutils.{cpp|h}` ()
* 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) ) ()
* Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) )

* Format
2022-12-13 07:52:58 +01:00
Oliver Stöneberg e01c463ff8
fixed - improved handling of suffixes in `MathLib::to{Double|ULong|Long}Number()` ()
* fixed  - 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 ()
* 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 Crash in valueFlowForwardConst() () 2022-12-12 22:58:48 +01:00
chrchr-github 3f5054035d
Fix FP passedByValue for overriden function () 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
Rikard Falkeborn ac525531d9
test-my-pr, mark --c-only and --cpp-only mutually exclusive ()
It makes no sense to specify both arguments at the same time.
2022-12-11 19:41:21 +01:00
Paul Fultz II 3f88744851
Fix 11358: FP containerOutOfBounds for container passed by pointer () 2022-12-09 19:43:21 +01:00
Oliver Stöneberg 40a69e5afb
optimized deserializing of `ErrorMessage` and related main process code () 2022-12-09 19:34:51 +01:00
Oliver Stöneberg bdee2ffc32
bump simplecpp () 2022-12-09 07:18:13 +01:00
Paul Fultz II 6eccb2e36c
Throw internal error when tokens are not in order ()
* 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 ()
* 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 ()
* Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement

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

* Fix   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 () 2022-12-08 07:27:06 +01:00
Oliver Stöneberg 4103d05c7f
improved `ErrorMessage::deserialize()` error messages () 2022-12-07 18:00:45 +01:00
chrchr-github 8713dabe58
Get type from iterator () 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 () 2022-12-07 09:20:09 +01:00
chrchr-github 89dba226dd
Fix FP uninitvar with unseen typedef () 2022-12-07 09:14:22 +01:00
chrchr-github 0e57c27dd3
Fix debug: CheckClass::checkConst found unlinked template argument list () 2022-12-07 09:12:46 +01:00
chrchr-github d5d7446433
Add cfg for std::scoped_lock, handle template arguments in checkMisusedScopedObject() () 2022-12-07 09:10:48 +01:00
Oliver Stöneberg 7d3ce62ee9
improved errorhandling related to deserializing `ErrorMessage` () 2022-12-03 15:44:33 +01:00
Rikard Falkeborn 9427fa3c66
Refactor runtests to allow to specify files on command line () 2022-12-03 15:41:11 +01:00
chrchr-github 0854fda28a
Get type from smartpointer ()
* Fix  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 FP knownConditionTrueFalse with container and brace init ()
* Fix  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 ...' ()
* Fix  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 checkLibraryFunction treats "auto" as type ()
* Fix  checkLibraryFunction treats "auto" as type

* Use utility function
2022-12-02 07:21:33 +01:00
Daniel Marjamäki 883908b439 triage tool: handle reports when cppcheck is run on local packages 2022-12-01 06:34:23 +01:00
Oliver Stöneberg 67f46b7353
donate-cpu: avoid unnecessary build invocation for `main` () 2022-11-28 20:49:05 +01:00
chrchr-github 428f5016d4
Partial fix for (iscpp11init) ()
* Partial fix for  (iscpp11init)

* Improve fix

* Add fix
2022-11-27 09:26:46 +01:00
chrchr-github 665e4230f2
Fix FP returnDanglingLifetime, std::unique_ptr and implicit conversion to bool () 2022-11-27 09:24:19 +01:00
chrchr-github 4cb49013a7
Fix FP danglingTemporaryLifetime with std::string_view () 2022-11-27 09:22:55 +01:00
Rikard Falkeborn 52264b9c26
Fix nullpointer dereference with alignof ()
* 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  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 () 2022-11-26 15:45:27 +01:00
Oliver Stöneberg 926bab9aba
CI-cygwin.yml: removed `x86` since it is no longer supported () 2022-11-25 23:13:28 +01:00
Oliver Stöneberg 01abf4c347
fixed macos build by manually installing `pcre` ()
* Makefile: bail out if `pcre-config` is missing

* CI-unixish.yml: install `pcre` for `macos` via `brew` since it suddenly disappeared from the runner images
2022-11-25 15:11:57 +01:00
Daniel Marjamäki c26a8fb4ce Fixed (Cant exclude file) 2022-11-24 13:45:57 +01:00
Stefan van Kessel a5c16af16d
Fix lambda capture template syntax error () 2022-11-23 20:15:10 +01:00
Oliver Stöneberg f6c2afa2ea
fix - donate-cpu: collect and avoid packages with no files to process () 2022-11-23 19:13:54 +01:00