Commit Graph

17006 Commits

Author SHA1 Message Date
Dmitry-Me fe5dd55723 Wrong reporting function was being called 2017-10-27 22:21:18 +03:00
Dmitry-Me f653b36b87 Fix actual type reported for unsigned ptrdiff_t passed into scanf 2017-10-26 23:47:11 +03:00
Dmitry-Me 65b2755098 Extract common check and run it first 2017-10-26 23:42:38 +03:00
Dmitry-Me 02e00a970b Restore test coverage for "x" conversion used with scanf 2017-10-26 23:36:55 +03:00
Björge Dijkstra 94031ef11d Fix for conditional memory allocation inside if-condition (#986)
* Add test cases for allocation inside if-condition

* Fix missed memory leak and false positive double free for allocation inside if-condition
2017-10-26 19:11:00 +02:00
KMilhan 76c3cef4d6 MISRA 15.7 only checks if...else if constructs (#983) 2017-10-26 08:47:53 +02:00
Dmitry-Me a38854451f Warn for signed values passed as scanf targets with "x" conversion 2017-10-25 21:22:17 +03:00
pmisik 9c8b0c2c90 Workaround for syntax error on Microsoft specific __pragma keyword (#982)
__pragma is Microsoft specific keyword equivalent to C99 _Pragma operator
https://msdn.microsoft.com/en-us/library/d9x1s805.aspx
https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas

It seems cppcheck does not support _Pragma at the moment.

This change will fix syntax error on code that looks like this:

 #define MY_DEPRECATED_ENUM(X) X __pragma(deprecated(X))
enum myEnum
{
    myEnum_1 = 1,
    MY_DEPRECATED_ENUM(myEnum_2) = 2,
    myEnum_3,
    myEnum_4,
};
int main()
{
    myEnum a = myEnum_3;
    printf("%d", a);
    return 0;
}

This change was fiscussed here: https://sourceforge.net/p/cppcheck/discussion/general/thread/1808a46b/
2017-10-25 14:40:00 +02:00
Dmitry-Me 2b717c6c31 Improve test coverage for %zd used with scanf 2017-10-24 23:47:04 +03:00
Dmitry-Me eaa12db761 scanf with %zd expects ssize_t, not ptrdiff_t 2017-10-24 22:01:23 +03:00
Dmitry-Me 709ee6e278 Revert "Initial test coverage for %zd used with scanf"
This reverts commit a260b5157a.
2017-10-24 00:20:04 +03:00
Dmitry-Me a748ced9da Improve test coverage for %zx, %zu used with printf 2017-10-23 23:44:22 +03:00
Dmitry-Me a260b5157a Initial test coverage for %zd used with scanf 2017-10-23 23:42:29 +03:00
Dmitry-Me 481ab0f930 Tests for passing non-pointers as scanf read targets 2017-10-23 23:35:32 +03:00
Dmitry-Me eb6bf1bcae Cache and reuse value 2017-10-23 00:42:56 +03:00
Dmitry-Me 1de8f771e9 Cache and reuse value 2017-10-23 00:41:29 +03:00
Dmitry-Me 46f726c049 Cache and reuse value 2017-10-23 00:36:05 +03:00
Daniel Marjamäki 539258f7a3 Fix FP for pointer addition checker 2017-10-22 23:13:12 +02:00
Daniel Marjamäki 28cfee2d4f Fixed #8250 (New check: Pointer calculation result cant be NULL unless there is overflow) 2017-10-22 14:32:54 +02:00
Daniel Marjamäki 002f6679d5 Fix syntax error 2017-10-21 22:17:07 +02:00
Daniel Marjamäki c4c76aa1ad Use MathLib::bigint_bits 2017-10-21 22:08:34 +02:00
Daniel Marjamäki 4cb3548e2b unsafeClassDivZero: change severity to style 2017-10-21 21:51:58 +02:00
Daniel Marjamäki 5de3c43209 changed id for new checker to unsafeClassDivZero 2017-10-21 21:45:04 +02:00
Ayaz Salikhov 64e61d28ba Add an ability to use address sanitizer (#979) 2017-10-21 21:04:14 +02:00
Daniel Marjamäki 15d814e609 classPublicInterfaceDivZero: Try to make the error message a bit better. Added variable name and what the bad input value is. 2017-10-21 13:00:52 +02:00
Daniel Marjamäki 7a67bced71 classPublicInterfaceDivZero: extend bailout 2017-10-21 12:40:20 +02:00
Daniel Marjamäki 299835da2f classPublicInterfaceDivZero: don't warn in overloaded operators. It is normal behaviour that these are not protected. 2017-10-21 08:56:23 +02:00
Daniel Marjamäki 05e1e5e0a0 astyle formatting
[ci skip]
2017-10-20 22:11:12 +02:00
Daniel Marjamäki 8a7411abdb CheckClass: Fix wrong 'public interface' warnings 2017-10-20 22:10:55 +02:00
Dmitry-Me 5bf29fae49 Tests for unrecognized conversion specifiers 2017-10-20 21:46:24 +03:00
Dmitry-Me 4e881e98cc Improve test coverage for %I used with printf 2017-10-20 21:13:14 +03:00
Matthias Krüger 3a42e31cc3 travis: fix typo in previous commit I made to this file.
Thanks to @hexcoder- for pointing out!
2017-10-20 19:26:05 +02:00
Daniel Marjamäki 819862ddcb Fix compiler errors 2017-10-20 17:38:15 +02:00
Daniel Marjamäki 1d5e3e4f0c Fixed #8247 (False positive knownConditionTrueFalse) 2017-10-20 17:31:58 +02:00
orbitcowboy b73d4ce62e wxwidgets.cfg: There is no need to use the return value from wxMenu::Append(). 2017-10-20 11:01:37 +02:00
Daniel Marjamäki 86c84029e3 New check: Check public interface of classes (#8248) 2017-10-20 02:02:51 +02:00
Daniel Marjamäki afbfc914bc astyle formatting
[ci skip]
2017-10-20 01:53:20 +02:00
Matthias Krüger db99eacbe9 travis: fail the entire job as soon as one of the run commands exits non-zero. 2017-10-19 22:44:52 +02:00
Dmitry-Me 7e2cef4952 Improve test coverage for %z used with printf 2017-10-19 19:05:16 +03:00
Dmitry-Me f070fa1977 Improve test coverage for passing pointers into printf 2017-10-19 19:03:12 +03:00
Dmitry-Me 5040491ee6 Size computation code not required outside this translation unit 2017-10-19 19:01:41 +03:00
Dmitry-Me 606e28a3c5 Extract and reuse size computation 2017-10-19 00:25:21 +03:00
Dmitry-Me 34a8d2431f Extract and reuse size computation 2017-10-19 00:20:04 +03:00
Dmitry-Me 8709490903 Clarify expressions with parentheses 2017-10-18 23:40:43 +03:00
Dmitry-Me e356ccca22 Revert "Clarify expression with parentheses"
This reverts commit bbf0a81c2d.
2017-10-18 23:31:44 +03:00
Dmitry-Me bbf0a81c2d Clarify expression with parentheses 2017-10-18 23:24:31 +03:00
Sign Bit aaafa72bc8 Use a 'negative cache' for tokens / enumerator checks (#980)
Checking whether a token is an enumerator in all the available scopes
is expensive.  Once we determined that a token is not an enumerator,
skip all the expensive checks.
2017-10-18 18:01:36 +02:00
Dmitry-Me 975132bc62 Improve test coverage for %td used with printf 2017-10-18 19:00:40 +03:00
Ali Can Demiralp bf174f583b Link to Shlwapi.lib on MSVC to get rid of missing symbol issues. (#978) 2017-10-18 17:38:15 +02:00
Dmitry-Me 151ace2581 Use Platform for char limits computation (#972) 2017-10-18 17:30:47 +02:00