82 Commits

Author SHA1 Message Date
Rikard Falkeborn
7973fd843c Refactor: Simplify checkSignConversion
The loop only checks astoperand1 and astoperand2. Simplify the condition
to loop over these instead of using a stack. Also, add a testcase for
when astoperand2 is negative.
2020-07-20 11:16:56 +02:00
Daniel Marjamäki
37245a8179 Update copyright year 2020-06-13 16:37:12 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy (#2633) 2020-05-23 07:16:49 +02:00
Rikard Falkeborn
4dbf006dc7 Fix severity of c++14 shifts with too many bits (#2213)
For c++14, shifting a variable with a value larger than or equal to the
number of bits in the variable is undefined. Left-shifting with a value
equal to the number of bits of the variable is implementation defined.

See also trac ticket #9306.
2019-09-25 20:16:04 +02:00
Paul Fultz II
e8435b9ecb Fix issue 9306: Adjust shiftTooManyBitsSigned for C++14 (#2127) 2019-08-31 07:40:57 +02:00
Daniel Marjamäki
20278d9c92 Clarify signConversion warning message 2019-08-05 12:41:08 +02:00
Daniel Marjamäki
45d1ca6f7c Safe checks: Clarify a warning message 2019-07-25 17:19:51 +02:00
Daniel Marjamäki
7c0b011c05 Fixed #9230 (Improve check: integer conversion overflow in return) 2019-07-24 16:17:52 +02:00
Daniel Marjamäki
421a8da6a8 Try to clarify signConversion message 2019-07-17 22:41:24 +02:00
Daniel Marjamäki
95d65c8c34 Refactoring; enum class 2019-07-10 14:05:16 +02:00
Rikard Falkeborn
1cc5f3abe7 Set wchar_t type (#1807)
This is necessary for valueflow to know the size, for example when
calculating sizeof(wchar_t).
2019-05-01 16:34:28 +02:00
Daniel Marjamäki
bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki
b79619832e Clarify warning 2018-12-23 12:42:18 +01:00
Daniel Marjamäki
435888f82e Refactoring; use range for loop 2018-07-13 16:57:17 +02:00
Daniel Marjamäki
79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
Daniel Marjamäki
b9c1308a81 Fixed #8575 (false positive: longCastAssign) 2018-06-04 22:51:21 +02:00
Daniel Marjamäki
f336c2efe7 Refactoring; Renamed Scope::classStart and Scope::classEnd 2018-04-27 22:36:30 +02:00
Daniel Marjamäki
a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
Daniel Marjamäki
7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
orbitcowboy
b7b376d901 checkTypes: Take into account type promotion to integer. 2018-02-19 23:55:38 +01:00
orbitcowboy
b1b3164259 checktype: Added handling of 'short'-type and added test cases. 2018-02-18 21:09:19 +01:00
orbitcowboy
50844aa7fc checkType: Take into account the size of char. 2018-02-18 14:28:48 +01:00
Daniel Marjamäki
85d8bbacb8 integerOverflow: Separate id for conditional integer overflows 2018-02-07 12:49:56 +01:00
Daniel Marjamäki
c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki
c4c76aa1ad Use MathLib::bigint_bits 2017-10-21 22:08:34 +02:00
Daniel Marjamäki
ba8222de1c ValueFlow: Put 'inconclusive' state in the ValueKind. A value can't be both known and inconclusive. 2017-09-20 22:41:36 +02:00
Daniel Marjamäki
840c7eb258 checkFloatToIntegerOverflow: check all calculations, not only in function bodies 2017-09-19 19:30:24 +02:00
Daniel Marjamäki
9268c2034a checkSignConversion: check all calculations, not only in function bodies 2017-09-19 19:25:33 +02:00
Daniel Marjamäki
f6e30eee19 checkIntegerOverflow: handle long and long long also 2017-09-19 19:14:29 +02:00
Daniel Marjamäki
cac7146cac checkIntegerOverflow: check all calculations, not only in function bodies 2017-09-19 14:43:48 +02:00
Daniel Marjamäki
6bc0df2908 checkTooBigBitwiseShift: Separate id for signed shift overflow 2017-09-19 09:21:20 +02:00
Daniel Marjamäki
be0ad20a04 checkTooBigBitwiseShift: bitshift overflow when lhs is signed 2017-09-19 09:08:44 +02:00
Daniel Marjamäki
0cf551351b tooBigBitwiseShift: check all calculations, not only in function bodies 2017-09-19 08:50:19 +02:00
Daniel Marjamäki
71b0370389 Fixed #1793 (CheckType::checkFloatToIntegerOverflow: assignments) 2017-08-23 05:34:47 +02:00
Ayaz Salikhov
28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki
f7cda81c0c Refactoring: ValueFlow::Value::errorSeverity() will have the logic if value is 'error' or 'warning' 2017-05-23 11:43:56 +02:00
Daniel Marjamäki
8ef9ab26b1 Clarify floatConversionOverflow 2017-05-22 11:04:24 +02:00
Daniel Marjamäki
0cb1c4f221 Clarify integerOverflow messages 2017-05-22 10:10:56 +02:00
Daniel Marjamäki
9374055238 ErrorPath: clarify the 'shiftTooManyBits' error message 2017-05-22 07:58:56 +02:00
PKEuS
b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +02:00
PKEuS
3c8f5b85ae Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10% 2017-03-27 18:48:34 +02:00
Daniel Marjamäki
28af5c0379 Integer Overflow: Don't warn about left-shift expressions with negative result like '1<<31'. That is common practice. 2016-12-21 18:19:59 +01:00
Daniel Marjamäki
87abe1174f floatConversionOverflow: Avoid warnings when 255.5 is converted to unsigned char etc. 2016-12-10 23:14:40 +01:00
Daniel Marjamäki
a198422f0e Fixed Coverity warning. Coverity assumes that 'bits < 64' means that bits can be 63. That is not true here but anyway I think the code needed to be fixed. 2016-11-25 15:19:18 +01:00
Daniel Marjamäki
0b3751520b Add a check for float conversion overflows 2016-11-22 22:37:13 +01:00
Daniel Marjamäki
4de5dc75aa Fixed #7807 (false positive: (error) Signed integer overflow for expression 'int32_max-1'.) 2016-11-07 22:29:40 +01:00
Daniel Marjamäki
f280061ff8 signed int overflow: warn about intmax+1 2016-11-05 09:29:52 +01:00
Roberto Martelloni
28f1222dc2 CWE mapping of useAutoPointerMalloc, uselessCallsCompare, uselessCallsSwap, uselessCallsSubstr, uselessCallsEmpty, uselessCallsRemove, derefInvalidIterator, reademptycontainer, multiplySizeof, divideSizeof, stringLiteralWrite, incorrectStringCompare, literalWithCharPtrCompare, charLiteralWithCharPtrCompare, incorrectStringBooleanError, staticStringCompare, stringCompare, signConversion, truncLongCastAssignment, truncLongCastReturn, unusedFunction, unusedVariable, unusedAllocatedMemory, unreadVariable, unassignedVariable, unusedStructMember, postfixOperator, va_start_wrongParameter (#824)
Add an optional extended description…
2016-09-03 00:31:35 +02:00
Daniel Marjamäki
920ac5a3f6 astyle formatting
[ci skip]
2016-07-16 21:21:24 +02:00
Roberto Martelloni
25525e38a7 CWE mapping of incorrectStringCompare, literalWithCharPtrCompare, charLiteralWithCharPtrCompare, incorrectStringBooleanError, staticStringCompare, stringCompare, signConversion, unusedFunction, unusedVariable 2016-07-16 10:07:06 +01:00