Commit Graph

617 Commits

Author SHA1 Message Date
Paul Fultz II 6b72274c67
Evaluate math library functions in valueflow (#4255)
* Evaluate math library functions in valueflow

* Format
2022-07-09 07:40:32 +02:00
chrchr-github 5b9fa9657d
Partial fix for #11137 FN: invalidFunctionArgStr printf argument (#4224)
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument

* Typo

* Remove <strz>, suppressions

* Add suppresion, remove <strz>

* Add suppressions
2022-06-20 20:02:22 +02:00
orbitcowboy eae164371c std.cfg: Added some missing <strz/>-flags 2022-06-03 21:24:20 +02:00
orbitcowboy 1e3efc1bdf std.cfg: Added some missing <strz/>-flags 2022-06-03 21:20:52 +02:00
orbitcowboy 345411a68c Fixed FP found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/i/imx-usb-loader/imx-usb-loader_0~git20200517.30b43d69.orig.tar.gz; imx_usb_loader/imx_loader_config.c:130:16: error: Invalid strncat() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-03 10:20:19 +02:00
orbitcowboy 8382ea7692 std.cfg: Improved configuration of strpbrk() and added regression tests. These cases were found in the wild (daca@home: ftp://ftp.de.debian.org/debian/pool/main/i/ion/ion_3.2.1+dfsg.orig.tar.gz, ion-open-source/contrib/dtnperf/dtnperf/src/utils.c:71:32: error: Invalid strpbrk() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr]). 2022-06-03 08:36:25 +02:00
orbitcowboy 4e9565b4e6 Fixed FP invalidFunctionArgStr, found a daca@home: ftp://ftp.de.debian.org/debian/pool/main/h/haskell-hs-bibutils/haskell-hs-bibutils_6.10.0.0.orig.tar.gz 2022-06-02 23:39:04 +02:00
orbitcowboy 67795cdfcf
Fixed FPs from Ticket 11119 - invalidFunctionArgStr with null-terminated strings (#4164)
* Fixed first FP from #11119 - invalidFunctionArgStr with null-terminated strings

* Fixed second test case from #11119.

* Fixed another FP, found on daca@home ftp://ftp.de.debian.org/debian/pool/main/g/glhack/glhack_1.2.orig.tar.gz.

* Format
2022-06-02 19:30:29 +02:00
orbitcowboy 63a8eac4d3 std.cfg: Added missing '<strz/>'-flags 2022-06-02 09:23:22 +02:00
orbitcowboy 886b5d1039 Improved invalidFunctionArgStr checking and detect more cases where a NON-null-terminated string is used to call functions, configured with <strz/>. 2022-06-02 01:09:09 +02:00
orbitcowboy cada21c101 std.cfg: Added support for std::minmax() 2022-05-21 16:46:19 +02:00
orbitcowboy f0b4c09804 std.cfg: Added support for std::minmax_element(). 2022-05-21 16:37:22 +02:00
orbitcowboy ac4ee8e63f std.cfg: Improved configuration of fmod[lf](). 2022-05-15 08:17:26 +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 6d3208ecb0
Fix 11062: false positive: knownEmptyContainer (regression) (#4106)
* Fix 11062: false positive: knownEmptyContainer (regression)

* Format
2022-05-12 06:24:16 +02:00
orbitcowboy f23111d610 std.cfg: Improved configuration of some <thread.h> (since C11) functions. 2022-05-10 19:21:41 +02:00
orbitcowboy 5a718c0820 std.cfg: Improved configuration of thrd_create(). 2022-05-10 18:58:21 +02:00
orbitcowboy 57e35513b9 std.cfg: Improved testing of std::system() 2022-05-10 13:53:16 +02:00
orbitcowboy 6152e5712a std.cfg: Improved configuration of std::filebuf::open(). 2022-05-10 10:17:27 +02:00
orbitcowboy 1382cd837e std.cfg: Improved configuration of std::*stream::open(). 2022-05-10 10:07:55 +02:00
orbitcowboy 6a3520164a std.cfg: Improved configuration of std::ifstream::open() and std::ios_base::open(). 2022-05-10 09:50:02 +02:00
orbitcowboy 440e8f9c22 std.cfg: Improved configuration of std::ofstream::write(), std::ostringstream::write(), std::ostream::write() and std::fstream(). 2022-05-10 09:30:13 +02:00
orbitcowboy b847882994 std.cfg: Improved configuration of vfwprintf(). 2022-05-08 18:15:22 +02:00
orbitcowboy 0db793fc51 std.cfg: Improved configuration of vfprintf() 2022-05-08 18:06:30 +02:00
orbitcowboy 1942bd5679 std.cfg: Improved configuration of fprintf() and added TODO tests for wcsftime() when array count value exceeds bounds. 2022-05-08 18:02:10 +02:00
orbitcowboy f3ae729f89 std.cfg: Improved configuration of fesetexceptflag() and fetestexcept(). 2022-05-05 15:07:06 +02:00
orbitcowboy 0ec2d5f40d std.cfg: Improved configuration of qsort(). 2022-05-02 11:58:31 +02:00
orbitcowboy 5db6fc1f54 std.cfg: Improved configuration of localtime_s() 2022-05-01 12:47:13 +02:00
orbitcowboy 6796f9daa2 std.cfg: Moved strdup() from posix.cfg to std.cfg since its now part of C23. 2022-04-27 12:41:40 +02:00
orbitcowboy 53ebb55e1f std.cfg: Improved configuration of setvbuf(). 2022-04-27 10:09:23 +02:00
orbitcowboy 17189e1d6e std.cfg: Improved configuration of strftime(). 2022-04-26 18:03:39 +02:00
orbitcowboy 80297acad0 std.cfg: Added missing <formatstr/> configuration to vswprintf(). 2022-04-25 18:40:14 +02:00
orbitcowboy d1b6954dd8 std.cfg: Improved configuration for wcsrtombs(). 2022-04-25 18:25:52 +02:00
orbitcowboy 0560a946a8 std.cfg: Added more tests 2022-04-22 08:00:45 +02:00
Paul Fultz II 54fbfd7c0f
Fix 10895: FP danglingTempReference with emplace() (#3948)
* Fix 10895: FP danglingTempReference with emplace()

* Format
2022-03-27 10:02:30 +02:00
amai2012 a143fa37dd
use-retval for localtime() (#3935)
* use-retval for localtime()

* Adjust test to avoid new warning
2022-03-25 17:32:54 +01:00
Armin Müller 7cc45fb393
Typos found by running "codespell" (#3907)
Co-authored-by: Armin Müller <mueller.armin@foestergroup.de>
2022-03-16 15:28:44 +01:00
chrchr-github 8a7992c6ac
Suppress operatorEqVarError for known non-copyable types (#3869)
* Fix FP operatorEqVarError with class hierarchy

* Suppress operatorEqVarError for std::mutex

* Add test, non-copyable Qt types

* Update cppcheck-cfg.rng
2022-03-03 09:41:26 +01:00
orbitcowboy 48f2524774 std.cfg: Added support for std::unordered_map::at() 2022-02-23 15:27:49 +01:00
chrchr-github 2f46e57311
Add leak-ignore for fopen_s(), test cases (#3839)
* Add leak-ignore for fopen_s(), test cases

* Format
2022-02-17 16:22:30 +01:00
chrchr-github a1adbff683
Fix #1733 FN Memory leak not detected when variable is 'used' by allocation function in condition (#3838) 2022-02-16 21:31:24 +01:00
orbitcowboy 59f07cd923 std.cfg: Added support for std::array::at() 2022-02-16 10:12:15 +01:00
orbitcowboy d36c4fc365 std.cfg: Added support for std::deque::at 2022-02-16 09:33:08 +01:00
orbitcowboy d3a2a6d245 std.cfg: Removed duplicate configuration of std::swap(). 2022-02-07 14:33:52 +01:00
orbitcowboy 2f17147900 std.cfg: Improved configuration for fseek(). The 3rd argument is not allowed to be of Boolean type. 2022-02-07 09:02:24 +01:00
orbitcowboy fa776051e9 Fixed Ticket 1001 - std.cfg: Invalid parameters for fseek() 2022-02-06 16:05:14 +01:00
orbitcowboy 7062b0a973 std.cfg: Improved configuration of std::[w]string::substr(). Do not allow negative length arguments. 2022-02-04 12:30:37 +01:00
orbitcowboy 81a25c0036 std.cfg: Added support for std::binary_search 2022-01-25 13:07:49 +01:00
chrchr-github 95dc05b21d
Fix #7732 false negative: (style) Unused variable: std::pair (#3695) 2022-01-13 08:05:05 +01:00
chrchr-github 1670805a8d
Fix #10490 FP unreadVariable with std::shared_lock (#3672) 2022-01-10 07:43:02 +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
orbitcowboy 19006ab775 std.cfg: Added support for string::shrink_to_fit() 2021-12-03 14:36:30 +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 8efe1d4ab4
Find reference to dangling unique ptr (#3344) 2021-07-20 21:30:27 +02:00
Paul Fultz II 59a1c1a9d8
Refactor: Remove variable analyzer (#3339) 2021-07-18 07:46:31 +02:00
orbitcowboy 8096fa4db1 std.cfg: Added overlappingWriteFunction-check to wcsncat(). 2021-07-16 14:30:49 +02:00
orbitcowboy e90a3053d4 std.cfg: Added a overlappingWriteFunction-check to strncat 2021-07-16 14:01:40 +02:00
orbitcowboy 435cffa858 std.cfg: Improved configuration of std::next(),std::prev() and added TODO tests 2021-07-14 10:12:49 +02:00
orbitcowboy 021a72f84b std.cfg: Improved support for overlapping data check 2021-07-10 18:27:53 +02:00
orbitcowboy c38a43c353 std.cfg: Added overlappingWriteFunction check to wcscpy(). 2021-07-10 09:20:51 +02:00
orbitcowboy 652e2765bc std.cfg: Added support for wcsncpy regarding data-overlapping 2021-07-09 16:32:54 +02:00
Daniel Marjamäki ce58748690 library: add attribute strlen-arg for <not-overlapping-data> 2021-07-09 13:25:01 +02:00
orbitcowboy 58811808d5 std.cfg: Improved configuration of 'strncpy', which is vulnerable for overlapping write issues. 2021-07-09 09:48:24 +02:00
orbitcowboy 3e7b6f262d std.cfg: Added not-overlapping-data configuration to wmemcpy() 2021-07-08 17:12:53 +02:00
Daniel Marjamäki 6234b5438e New check: Writing overlapping data, detect undefined behavior 2021-07-05 22:07:41 +02:00
chrchr-github 39f9bc7422
Fix #10304: std::distance() returns std::ptrdiff_t (#3297) 2021-06-24 23:19:29 +02:00
orbitcowboy 6a193139dc std.cfg: Added support for 'std::ostringstream::write' 2021-06-03 09:27:27 +02:00
orbitcowboy dd8668102f std.cfg: Added support for more interfaces 2021-06-03 08:25:22 +02:00
orbitcowboy 025a04c3e0 std.cfg: Added support for more interfaces 2021-06-03 08:21:16 +02:00
orbitcowboy f626035963 std.cfg: Added support for more interfaces 2021-06-03 08:07:53 +02:00
orbitcowboy 39912b5096 std.cfg: Added support for more interfaces 2021-06-03 07:55:26 +02:00
orbitcowboy 4c81a59c0b std.cfg: Added support for more interfaces 2021-06-03 07:33:23 +02:00
keinflue 6541f52e61
Fix false positive invalidFunctionArg for zero arguments to calloc. (#3238) 2021-05-01 12:39:01 +02:00
orbitcowboy f62d9d5853 std.cfg: Fixed bufferAccessOutOfBounds false negative for strncmp(). 2021-04-13 19:13:00 +02:00
orbitcowboy 040e58f943 std.cfg: strxfrm(): Added minize values to arg1 and arg2 and a TODO test case 2021-04-13 14:07:45 +02:00
Daniel Marjamäki 9ce0235e8e std.cfg: Fixed configuration of mbstowcs 2021-04-03 10:42:24 +02:00
Daniel Marjamäki e09e393503 std.cfg: Tweaked std::distance return type, result can be negative. 2021-04-03 08:48:58 +02:00
Rikard Falkeborn a8a0dbec26
cfg: Add config for toupper/tolower (#3028) 2021-01-08 08:34:09 +01:00
Daniel Marjamäki b94a6d595a Fixed #9295 (ValueFlow: Does not handle noreturn function) 2020-12-28 20:00:35 +01:00
orbitcowboy ead4958cc0 std.cfg: Added 'SEEK_*' constants 2020-12-25 12:34:33 +01:00
orbitcowboy 4bf827e44d std.cfg: Added support bsearch_s() which was introduced with C11 2020-10-01 08:32:48 +02:00
orbitcowboy 98b6238450 std.cfg: Added return values for 'wmemmove' and 'memmove' 2020-09-21 08:50:28 +02:00
orbitcowboy 0320979d7f std.cfg: Added support for 'std::generate' 2020-09-07 17:07:59 +02:00
orbitcowboy c726c34fdf std.cfg: Updated commit f396571b6c and moved 'memcpy' to the right place 2020-09-05 07:30:03 +02:00
orbitcowboy f396571b6c std.cfg: Defined own rule for wmemcpy to avoid FPs because of different return types. 2020-09-05 07:12:41 +02:00
Georgy Komarov f5877e327b
std.cfg: Fix memcpy return type (#2777) 2020-09-05 06:29:39 +02:00
orbitcowboy ad8d8ca11d std.cfg: Added support for std::advance. Reference: https://en.cppreference.com/w/cpp/iterator/advance 2020-07-24 10:21:57 +02:00
orbitcowboy 8ab02ed97a std.cfg: Improved bsearch() configuration 2020-07-01 15:06:00 +02:00
orbitcowboy 0770a6fe62 std.cfg: Added support for std::at_quick_exit() 2020-07-01 14:43:17 +02:00
orbitcowboy 27d6b9a57d std.cfg: Formatted comments, there are no functional changes [ci skip] 2020-07-01 11:12:22 +02:00
orbitcowboy a3d58a9302 std.cfg: Allow scientific floating point notation for '<valid>'-tags 2020-06-12 08:51:33 +02:00
orbitcowboy 05b98712e8 std.cfg: Added valid range for 'acosh' 2020-06-11 09:22:24 +02:00
orbitcowboy 6c93a82575 std.cfg: Added valid range for 'atanh' 2020-06-11 09:19:47 +02:00
Daniel Marjamäki efb583e3d1 astyle formatting
[ci skip]
2020-04-04 10:31:38 +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
orbitcowboy e1eb7e04b5 std.cfg: Added <not-bool/>-flags for some functions from <cwctype> 2020-02-22 14:24:14 +01:00
orbitcowboy a62ddc6edd std.cfg: Added <not-bool/>-tag to isblank() function arg. 2020-02-22 09:43:15 +01:00
orbitcowboy be96abc21a std.cfg: Added <not-bool/>-tags to <cctype> function args. 2020-02-22 09:39:21 +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