224 Commits

Author SHA1 Message Date
Oliver Stöneberg
1d95d1908d
refs #10663 - sped up Library::detectContainerOrIterator() by iterating the containers only once (#4380) 2022-08-20 12:14:55 +02:00
Oliver Stöneberg
16f598c409
added missing sstream includes (#4381) 2022-08-19 10:16:23 +02:00
Oliver Stöneberg
f7caf7dc93
avoid some unnecessary std::string() construction in comparisons (#4357)
* avoid unnecessary string wrapping

* consistently use `strcmp()`
2022-08-14 12:44:09 +02:00
PKEuS
9eb16e1002
Replaced check for pipe() buffer size by ordinary CheckBufferOverrun, provide required Library configuration option (#4183)
Merged from LCppC.
2022-06-19 12:01:55 +02:00
Rikard Falkeborn
187460a277
Library: Replace auto with real types (#4207)
Following up on fc6c203b0e76, replace auto with the correct types to
clairfy the code. Note the use of const on the first type in the pair,
which allows us to use a reference.
2022-06-11 23:21:25 +02:00
Rikard Falkeborn
fc6c203b0e
Library: Use range-based for loops (#4200) 2022-06-11 13:51:55 +02:00
PKEuS
898a3a25a1
ValueType: Added additional unit test (#4185)
Removed unnecessary library export

Backported from LCppC.
2022-06-08 15:27:56 +02:00
orbitcowboy
4f410ffb79
library: Improved argument <valid>-interface to defined values that are explicitly excluded. (#4111)
* library: Improved <valid>-interface to defined values that are explicitly excluded.

* std.cfg: Improved configuration of remainder[fl]().

* Fixed failing self check

* Fixed failing self check

* std.cfg: Added support for std::remquo().
2022-05-14 16:05:18 +02:00
Paul Fultz II
fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member (#4103)
* Fix 11057: FP danglingTemporaryLifetime with reference member

* Add test

* Format

* Use ast for number of arguments

* Get number of arguments using ast

* Skip aggregate constructor when there are too many arguments

* Format
2022-05-13 06:51:07 +02:00
Oliver Stöneberg
45158ec064
cleaned up includes based on include-what-you-use (#4007)
* cleaned up includes based on include-what-you-use

* updated translations
2022-04-13 12:24:00 +02:00
Daniel Marjamäki
8f386e15fd Remove bug hunting. This feature will be provided in Cppcheck premium. 2022-04-11 07:31:33 +02:00
Paul Fultz II
09c8cfb2ae
Fix 6624: false negative: std::vector out of bounds access not detected (#3980)
* Fix 6624: false negative: std::vector out of bounds access not detected

* Format

* Add test for auto

* Fix tests

* Format
2022-04-07 06:47:15 +02:00
Paul Fultz II
4fde7f8b18
Fix 10449: Regression: knownConditionTrueFalse (strlen/wcslen) (#3977)
* Refactor library function usage

* Evaluate library function in program memory

* Fix and add tests

* Format
2022-04-06 06:35:38 +02:00
Daniel Marjamäki
3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg
171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
Oliver Stöneberg
55ff684f34
added unusedFunction self check to CI / cleanups (#3526) 2022-01-18 22:02:25 +01:00
Daniel Marjamäki
77434d093e SymbolDatabase: Do not set wrong type for std::map etc items in range for loop 2021-12-11 15:16:54 +01:00
Paul Fultz II
8668d445c7
Add support for string_view (#3480) 2021-10-05 08:28:19 +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
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
7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki
b1547a387e astyle formatting
[ci skip]
2021-07-21 20:13:38 +02:00
Paul Fultz II
8efe1d4ab4
Find reference to dangling unique ptr (#3344) 2021-07-20 21:30:27 +02:00
Daniel Marjamäki
ce58748690 library: add attribute strlen-arg for <not-overlapping-data> 2021-07-09 13:25:01 +02:00
Daniel Marjamäki
6234b5438e New check: Writing overlapping data, detect undefined behavior 2021-07-05 22:07:41 +02:00
Daniel Marjamäki
e1dd04c536 Fixed make checkcfg 2021-05-01 19:17:07 +02:00
Daniel Marjamäki
e78612d280 Refactoring; Use TinyXml methods to parse bool/int attribute values 2021-05-01 18:40:20 +02:00
Paul Fultz II
563c9dd9cc
Fix issue 10208: FP: knownConditionTrueFalse in for loop with function that assigns by ref (#3198) 2021-04-18 21:42:27 +02:00
Daniel Marjamäki
42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
Oliver Stöneberg
e8b8cfec78
some minor optimizations (#3057) 2021-01-28 22:18:17 +01:00
Oliver Stöneberg
7aa85aa408
Use std::unordered_* containers for faster lookups (#3052) 2021-01-16 13:52:09 +01:00
Rikard Falkeborn
bedf3118ef
library: Refactor to use enum class (#3026) 2021-01-08 10:29:01 +01:00
Daniel Marjamäki
b94a6d595a Fixed #9295 (ValueFlow: Does not handle noreturn function) 2020-12-28 20:00:35 +01:00
Georgy Komarov
80dee36e68
library: Add new warning: ignoredReturnErrorCode (#2877)
* library: Add optional "type" attribute to "use-retval"

Added an optional "type" attribute to "use-retval" nodes in the
configuration. When the return type of a function configured with
`<use-retval type="error-code"\>` node does not used, the new style
error "ignoredReturnErrorCode" will be generated.

* Fix and improve patch after the initial review

* Fixed severity level and [[nodiscard]] attribute

* Fix incorrect condition

* Remove redundant condition
2020-11-05 13:35:52 +01:00
Daniel Marjamäki
6c588cc3ef Library: Refactoring <alloc> init attribute 2020-06-28 21:01:43 +02:00
orbitcowboy
258d0a6ade Running astyle [ci skip]. 2020-06-12 16:08:40 +02:00
orbitcowboy
9f445fc735 Library: simplified code and added test cases for validating <valid>-tag expressions 2020-06-12 16:06:43 +02:00
orbitcowboy
a3d58a9302 std.cfg: Allow scientific floating point notation for '<valid>'-tags 2020-06-12 08:51:33 +02:00
Daniel Marjamäki
ca8b5f49f3 library: fixed handling of indirect attribute 2020-06-07 20:18:54 +02:00
Daniel Marjamäki
5a4b309e6f Bug hunting: Add 'buffer overflow' check. Detect CVE-2019-19334 2020-05-23 17:50:24 +02:00
Daniel Marjamäki
08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki
3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd53d42e3a1179fd3a8a7dae5a43d4d50.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki
6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Paul Fultz II
a22a77c1fc
Use library config for unstable containers instead of hardcoded values (#2585)
* Use library config for unstable containers instead of hardcoded values

* Fix xml validation
2020-04-03 13:16:57 +02:00
Daniel Marjamäki
747a01f74d Verification; Check function argument values 2019-12-23 22:10:43 +01:00
Sebastian
c3c3d6770c
Fix #9478: Valueflow: printf does not change value (#2388)
Format-string arguments are now marked to have `in` direction, except
for `scan`-functions (like `scanf`) where these arguments are explicitly
marked to have `out` direction.
2019-11-24 01:40:31 +01:00
Sebastian
c990d10ffa
Check for JSON error when parsing addon .json files + fixes (#2374)
* cppcheck.cpp: Check for JSON error when parsing addon .json files

This fixes that errors in JSON files given via `--addon=*.json` are
silently ignored and maybe only a part of the JSON file is used.
Now the error message which picojson can return is checked and a
corresponding error message is returned again by getAddonInfo().

* naming.json: Fix missing comma

* CLI: Fix naming violations detected by addon naming.py via naming.json

* Addon naming: Add argument for validating names of constants

* LIB: Rename functions/variables so they are valid, loosen naming rules

* GUI: Fix naming violations
2019-11-20 15:37:09 +01:00
Daniel Marjamäki
f5e3dc9a38 Improved fix for #8978 (False positive: Variable assigned value that is never used when assigning via iterator) 2019-11-17 12:08:21 +01:00
Paul Fultz II
4ebf54d090 Fix issue 9437: Dont assume init list constructor for strings (#2366)
* Fix issue 9437: Dont assume init list constuctor for strings

* Update the schema

* Add documentation
2019-11-17 03:22:04 +01:00
Paul Fultz II
7841430793 Fix issue 9428: FP uninitvar for pointer passed to sscanf (#2344)
* Add indirect to library cfg files

* Check indirect for non null arguments

* Reenable subfunction analysis

* Use indirect 1 when using not-null

* Parse correct string name

* Update documentation

* Make attribute optional
2019-11-13 12:46:54 +01:00