Commit Graph

250 Commits

Author SHA1 Message Date
Oliver Stöneberg f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly (#3767) 2022-02-10 23:02:24 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
chrchr-github f429245da2
Fix #8557 FP format string requires unsigned long (for sizeof(var)) (#3727) 2022-01-27 19:43:52 +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
Paul Fultz II abb0563cef
Fix 10726: Crash in CheckExceptionSafety::checkRethrowCopy (#3711) 2022-01-16 12:35:51 +01:00
chrchr-github ca4e5ac527
Fix #7038 false negative for string argument in the CheckIO (#3649) 2021-12-20 17:22:39 +01:00
chrchr-github 4a1a1534df
Fix #10632 (FN charset in format string) (#3590)
* Fix #10632

* Typo
2021-12-01 09:51:48 +01:00
chrchr-github ca311ebcdf
ASSERT() on calls to Tokenizer::tokenize() in test code (#3501) 2021-11-29 07:34:39 +01:00
FabianWolff cd5fa015c1
Fix incorrect warning with `%zi` in format string (#3437) 2021-09-05 07:34:22 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki 9841e0ed96 new check; file can not be opened for read and write access at the same time on different streams (misra rule 22.3) 2021-07-10 13:59:47 +02:00
Daniel Marjamäki 2f7f43e1f2 astyle formatting 2021-06-24 23:19:59 +02:00
chrchr-github 39f9bc7422
Fix #10304: std::distance() returns std::ptrdiff_t (#3297) 2021-06-24 23:19:29 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01:00
PKEuS 2bd6a6c252 Test suite:
- Enabled test in testgarbage.cpp that succeeds
 - Optimizations in TestIO

Merged from LCppC.
2021-02-20 13:00:30 +01:00
PKEuS cf1937294a Refactorization: Removed unnecessary \n and spaces in strings
Merged from LCppC.
2021-02-20 12:58:42 +01:00
Daniel Marjamäki 3fe2b6fe50 Update test. An inconclusive warning message is now shown. 2020-06-14 22:57:50 +02:00
PKEuS fb1afe2345 Fixed test suite: Do no longer apply simplifyTokenList2 to token lists, except for those tests that test those simplifications, because checks are no longer run on that simplified token list
Changed failing unit test to TODO tests, as they indicate patterns we do no longer understand properly.
2020-05-20 18:54:16 +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 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Rikard Falkeborn 8819e19dae Fix #8489 (Fix FN printf argument with parenthesis) (#2508) 2020-01-27 06:55:01 +01:00
Dmitry-Me 98488790a1 Improve test coverage for %jd used with scanf() 2019-11-20 18:10:56 +03:00
Dmitry-Me cfac54c42a Improve test coverage for %I32d used with scanf() 2019-11-19 18:05:21 +03:00
Wolfgang Stöggl 1ea3fc8083 Allow SSIZE_T in addition to ssize_t (#2263)
The Windows Data Type SSIZE_T is declared in BaseTsd.h
However, it is written in capital letters

- Fixes e.g. the following false positive:
  (portability) %zd in format string (no. 1) requires 'ssize_t' but the
  argument type is 'SSIZE_T {aka signed long long}'.
  [invalidPrintfArgType_sint]
2019-10-24 21:51:20 +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
rikardfalkeborn 0e988cc755 Fix #8992: Add originalTypeToken to auto (#1701) 2019-02-27 06:44:31 +01:00
rikardfalkeborn dc4e7cef88 Run simplifyPlatformTypes on library return types (#1672)
Add a call to simplifyPlatformTypes() in
SymbolDatabase::setValueTypeInTokenList() to simplify return types of
library configured functions. This fixes the FN in #8141. Regression
tests are added, both for the original issue and another FN in the comments.

In order to do that, move simplifyPlatformTypes() to TokenList from Tokenizer.
This is a pure refactoring and does not change any behaviour. The code was
literally copy-pasted from one file to another and in two places
'list.front()' was changed to 'front()'.

When adding the call to simplifyPlatformTypes(), the original type of
v.size() where v is a container is changed from 'size_t' to 'std::size_t'.
Tests are updated accordingly. It can be noted that if v is declared as
'class fred : public std::vector<int> {} v', the original type of 'v.size()'
is still 'size_t' and not 'std::size_t'.
2019-02-15 13:29:52 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki 8dd641b8be Use OVERRIDE in test 2019-01-12 15:45:25 +01:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki 0daa3bba30 ValueType: Improved type handling of containers when [] operator is used 2018-04-06 22:26:35 +02:00
Sebastian 2e5d7a8391 Fix #8381: false positives for swprintf_ and stprintf_s (#1080)
This fixes false positives because of wrong configuration in
windows.cfg.
Add tests in testio.cpp and test/cfg/windows.cpp to avoid regression.
2018-02-03 05:10:52 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
IOBYTE 03603c85cf Fixed #8331 (stack overflow: daca: firefox-58.0b14) (#1027) 2018-01-12 08:19:21 +01:00
PKEuS b684e1f202 Updated AStyle to version 3.0.1 2018-01-08 20:20:33 +01:00
Dmitry-Me 4ac56a55be Fix FN for signed short passed as %hx into printf 2017-11-21 22:17:02 +03:00
Dmitry-Me c6bf881ee6 Fix FN for signed char passed as %hhx into printf 2017-11-21 22:14:48 +03:00
Dmitry-Me 5869f6d989 Fix FN for std::intmax_t passed as %ld, %lld into scanf 2017-11-20 23:07:37 +03:00
Dmitry-Me 7cf21f329a Fix FN for size_t, uintmax_t passed as %lx and %llx into printf 2017-11-20 22:56:33 +03:00
Dmitry-Me f0a7365f35 Fix FN for ptrdiff_t passed as %Ix into printf 2017-11-20 22:51:10 +03:00
Dmitry-Me 20eaf3fcca Tests for intmax_t passed as %ld and %lld into scanf 2017-11-20 22:34:31 +03:00
Dmitry-Me eb4bb893b3 Fix FP for std::intmax_t passed as %jd into scanf 2017-11-20 22:31:13 +03:00
Dmitry-Me 125daec71b Tests for std::intmax_t passed as %ju and %jx into scanf 2017-11-20 22:14:00 +03:00
Dmitry-Me c4b6db7e23 Fix FP for std::uintmax_t passed as %ju and %jx into scanf 2017-11-20 22:13:20 +03:00
Dmitry-Me cf05b722a9 Fix FN for intmax_t passed as %jx into printf 2017-11-18 00:00:02 +03:00
Dmitry-Me 73414ee56c Fix FN for std::uintmax_t passed as %Lu and %Lx into scanf 2017-11-17 23:58:09 +03:00
Dmitry-Me 167258a6bf Fix FNs when various types are passed as %tu into printf 2017-11-15 22:40:16 +03:00
Dmitry-Me 7f48283b98 Improve test coverage for %I64x used with scanf 2017-11-13 21:47:56 +03:00