Commit Graph

159 Commits

Author SHA1 Message Date
orbitcowboy 53ebb55e1f std.cfg: Improved configuration of setvbuf(). 2022-04-27 10:09:23 +02:00
orbitcowboy 561e21e2aa std.cfg: Improved tests for setbuf(). 2022-04-27 09:21:09 +02:00
orbitcowboy 17189e1d6e std.cfg: Improved configuration of strftime(). 2022-04-26 18:03:39 +02:00
orbitcowboy 7e3ac96ebc std.cfg: Improved tests of vswprintf(). 2022-04-26 17:50:59 +02:00
orbitcowboy d1b6954dd8 std.cfg: Improved configuration for wcsrtombs(). 2022-04-25 18:25:52 +02:00
orbitcowboy a75ecbca0e std.cfg: Improved tests for wcsftime(). 2022-04-22 08:29:20 +02:00
orbitcowboy 0560a946a8 std.cfg: Added more tests 2022-04-22 08:00:45 +02:00
orbitcowboy b315e8a115 std.cfg: Added more tests for wmemmove() and wmemset(). 2022-04-22 07:25:27 +02:00
orbitcowboy 1bf7b3b7dd std.cfg: Added more tests for memcmp(), memcpy() and memmove(). 2022-04-21 21:01:38 +02:00
orbitcowboy ce35a6c975 std.cfg: Added more tests for strcat() and strcpy(). 2022-04-21 16:59:25 +02:00
orbitcowboy e683f3ce28 std.cfg: Added more test for strncpy(). 2022-04-21 16:47:19 +02:00
orbitcowboy 7f48127c0b std.cfg: Added more test for strncat(). 2022-04-21 16:43:52 +02:00
orbitcowboy a6f87e6b8a std.cfg: Added more test for strcmp(). 2022-04-21 16:13:48 +02:00
orbitcowboy e06169cf8d std.cfg: Added more test for strncmp() and wmemcmp(). 2022-04-21 16:09:36 +02:00
orbitcowboy 49057543a1 std.cfg: Ensure a warning is issued for null pointer input for strlen(). 2022-04-21 09:09:46 +02:00
orbitcowboy 5be16c3113 std.cfg: Ensure null pointer input is correctly handled for fgets() and fgetws(). 2022-04-20 08:50:45 +02:00
orbitcowboy e0942c1bb4 std.cfg: Ensure warnings are issued for passing null pointer to bsearch(). 2022-04-19 21:21:35 +02:00
Daniel Marjamäki b3f9df968b Uninitvar: fixed 'make checkcfg' 2021-10-03 20:32:39 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki 22ae4543a6 Fixed 'make checkcfg' 2021-05-22 07:39:27 +02:00
Daniel Marjamäki 6a0a2456b5 make checkcfg; temporarily disable suppressions 2021-05-16 22:48:22 +02:00
Daniel Marjamäki 45eb9f82a0 Fix CI; Cppcheck find some more unusedAllocatedMemory violations in test/cfg/.. 2021-05-13 23:08:58 +02:00
orbitcowboy f62d9d5853 std.cfg: Fixed bufferAccessOutOfBounds false negative for strncmp(). 2021-04-13 19:13:00 +02:00
orbitcowboy 03bdcc4c42 Attempt to make CI happy 2021-04-13 16:57:31 +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
Jens Yllman a87686911a one more test updated for the new checkLibraryFunction 2020-06-23 09:06:54 +02:00
orbitcowboy a3d58a9302 std.cfg: Allow scientific floating point notation for '<valid>'-tags 2020-06-12 08:51:33 +02:00
orbitcowboy e767bb8ff3 std.cfg: Added tests for 'atanh' 2020-06-11 15:13:19 +02:00
orbitcowboy 0fe0e56986 std.cfg: Added tests for 'acosh' 2020-06-11 15:07:35 +02:00
orbitcowboy 4880f30dc3 std.cfg: Added tests for 'aligned_alloc' 2020-06-10 19:33:22 +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
Armin Müller 130ebe4b85 Typos found by running "codespell" (#2380) 2019-11-19 20:02:24 +01:00
orbitcowboy 2ff18b76ec test std.cfg: Improved tests for strncpy and strrchr . 2019-11-18 13:53:42 +01:00
orbitcowboy d5d2915873 test std.cfg: Improved tests for strncmp and strncat. 2019-11-18 13:43:49 +01:00
orbitcowboy dbbb7f544a test std.cfg: Improved strlen() tests. 2019-11-14 16:45:27 +01:00
orbitcowboy ea92695e54 test std.cfg: Improved sscanf() tests. 2019-11-14 16:38:30 +01:00
orbitcowboy ade54bef3f test std.cfg: Added better tests. 2019-11-14 10:48:23 +01:00
orbitcowboy dd30f37642 std.cfg: Merged 'wcscmp' and 'strcmp' configurations and added better tests. 2019-11-14 08:43:31 +01:00
orbitcowboy 20e2c513b6 test std.cfg: Added better test cases for toupper() and tolower(). 2019-11-14 08:31:00 +01:00
orbitcowboy 09eaa412b1 std.cfg: Improved cfg for 'mbstowcs' 2019-11-13 16:55:17 +01:00
orbitcowboy aa5c42ffc5 test std.cfg: Addressed comments from 177eed122a (comments) 2019-11-13 15:07:57 +01:00
orbitcowboy 177eed122a std.cfg: Added 'indirect' flag for destination argument of 'mbstrtowc' function. 2019-11-13 14:34:02 +01:00
orbitcowboy 7c48874793 #9347: Added a robustness test for scanf 2019-10-17 17:50:26 +02:00
Sebastian e24008544e
test/cfg/std.c: Add nullPointer tests for vsnprintf() (#2262)
Related tickets:
https://trac.cppcheck.net/ticket/9408
https://trac.cppcheck.net/ticket/9410
2019-10-11 20:00:10 +02:00
Paul Fultz II ba037837c9 Track lifetime across multiple returns
This will now warn when doing something like this:

```cpp
template <class T, class K, class V>
const V& get_default(const T& t, const K& k, const V& v) {
    auto it = t.find(k);
    if (it == t.end()) return v;
    return it->second;
}
const int& bar(const std::unordered_map<int, int>& m, int k) {
    auto x = 0;
    return get_default(m, k, x);
}
```

The lifetime warning is considered inconclusive in this case.

I also updated valueflow to no tinject inconclusive values unless `--inconclusive` flag is passed. This creates some false negatives because library functions are not configured to not modify their input parameters, and there are some checks that do not check if the value is inconclusive or not.
2019-09-11 19:25:09 +02:00
orbitcowboy 1994cbbb9c std.cfg: Improved configuration for mbrlen() and extended test cases. 2019-08-27 08:18:19 +02:00
Rikard Falkeborn 8cd1d5a47d Use library for memleak checks (#2002)
* Use library for memleak checks

Change memleakOnRealloc and leakReturnValNotUsed to use library
configuration instead of hardcoding "realloc".

In order to do so, some care needs to be taken when matching for a
reallocation function, since it can no longer be assumed that the input
to be allocated is the first argument of the function. This complicates
getReallocationType() and checkReallocUsage() but is necessary in order
to handle for example freopen() properly.

Also, refactor memleakOnRealloc check to reduce duplicated code when
checking "a" and "*a". When doing so, extending the check to look for
arbitrary number of "*" can be done for free (just change an if
statement to a while statement). Most likely, this is an unusual case in
real world code.

* Remove redundant whitespace in Token::Match()

* Run on simplified checks

* Fix cppcheck warning
2019-07-22 10:37:36 +02:00