Rikard Falkeborn
295153df72
Checkstring fixes ( #1783 )
...
* teststring.cpp: Fix ternary syntax in tests
* stringLiteralWrite: Add tests wide character and utf16 strings
* suspiciousStringCompare: Add test with wide character string
* strPlusChar: Handle wide characters
* incorrectStringCompare: Add test with wide string
* Suspicious string compare: suggest wcscmp for wide strings
* deadStrcmp: Extend to handle wide strings
* sprintfOverlappingData: Print name of strcmp function
* Conversion of char literal to boolean, add wide character tests
* Conversion of char literal to boolean, fix ternary
2019-04-06 06:54:38 +02:00
Daniel Marjamäki
f1146e398a
Moved CheckString::sprintfOverlappingData from runSimplifiedChecks to runChecks
2019-02-25 09:23:03 +01:00
rikardfalkeborn
a3e717bea9
Use functions instead of comparing with enum ( #1471 )
...
* Use isComparisonOp() instead of enum
* Use isAssignmentOp() instead of enum
2018-11-09 06:30:41 +01:00
Paul Fultz II
f65cf220ba
Fix false positives in unknownEvaluationOrder when using followVar ( #1391 )
...
Fix false positives in unknownEvaluationOrder when using followVar
2018-09-28 08:38:24 +02:00
Daniel Marjamäki
be4ae66e36
Fix wrong message
2018-08-12 08:01:15 +02:00
Daniel Marjamäki
f2e7071922
Fix FP, conversion of char literal '\0' to boolean is not true
2018-08-08 19:04:10 +02:00
Daniel Marjamäki
58c91c4645
Revert "Refactoring endsWith utility function"
...
This reverts commit d300d1f61b
.
2018-07-25 16:14:43 +02:00
Daniel Marjamäki
d300d1f61b
Refactoring endsWith utility function
2018-07-25 07:43:50 +02:00
Daniel Marjamäki
77b653bf94
Clarify warnings when char literals are converted to bool in conditions
2018-07-21 18:40:06 +02:00
Daniel Marjamäki
2963522d5f
Refactoring: Use ranged for loops
2018-07-13 16:40:15 +02:00
Daniel Marjamäki
79ffe1d4fc
Rename _tokenizer, _settings, _errorLogger
2018-06-16 16:10:28 +02:00
orbitcowboy
33777c5b72
Improved const correcntess of local variables.
2018-05-29 13:24:48 +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
jrp2014
b6504c70ca
Improve constness
2018-04-04 21:51:31 +02:00
Daniel Marjamäki
7e4dba6a7e
Updated copyright year
2018-03-31 20:59:09 +02:00
Martin Ettl
9816358e8b
Cleanup not needed variable.
2018-01-19 22:41:51 +01:00
Daniel Marjamäki
c4caee6b18
Updated copyright year
2018-01-14 15:37:52 +01:00
Daniel Marjamäki
d292434e76
Try again to clarify warning message for new strcmp() checker
2017-12-13 15:28:50 +01:00
Daniel Marjamäki
3f36d4b5f4
try to clarify error message
2017-12-11 22:10:00 +01:00
Daniel Marjamäki
43db6147d3
astyle formatting
...
[ci skip]
2017-11-27 23:32:20 +01:00
Daniel Marjamäki
f28d5e91ac
Fixed #8251 (Condition: bug when there are more than 2 strcmp() on same buffer (tricky))
2017-11-27 12:55:20 +01:00
Ayaz Salikhov
28aa939d69
iwyu - include what you use
2017-05-27 04:33:47 +02:00
Daniel Marjamäki
198c8878ee
Use Token::simpleMatch() for simple pattern
2017-04-23 12:14:14 +02:00
Daniel Marjamäki
f2719ec6ca
Refactoring CheckString::sprintfOverlappingData. Use AST, isSameExpression(), getArguments(), ..
2017-04-23 10:51:31 +02:00
Daniel Marjamäki
f92ef7d8e2
Refactoring. Use 'endsWith()'
2017-04-23 10:17:35 +02:00
PKEuS
b1f4bd7504
Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set ( #7995 )
2017-04-11 11:49:26 +02:00
Daniel Marjamäki
d09a8dde57
Improved char literal handling. In the 'normal' tokenlist these should not be simplified to integer literals.
2016-10-12 10:20:24 +02:00
Daniel Marjamäki
0e785e435e
charLiteralWithCharPtrCompare: Improved warning to catch any char literal
2016-10-09 11:39:20 +02: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
PKEuS
c7b3836379
Small refactorizations:
...
- Optimized performance of several functions by adding pre-checks
- Simplified some code
- Fixed VS warning in testsymboldatabase.cpp
2016-05-25 15:30:49 +02:00
Roberto Martelloni
50fc784550
Mapped error ids stlBoundaries, stlcstr, useAutoPointerContainer, useAutoPointerArray, sprintfOverlappingData, strPlusChar, shiftTooManyBits, integerOverflow, uninitstring, uninitdata, uninitvar, uninitStructMember, deadpointer, va_start_referencePassed, va_end_missing, va_list_usedBeforeStarted, va_start_subsequentCalls to their CWEs.
2016-02-03 12:53:23 +00:00
Daniel Marjamäki
8e2f7812fd
CheckString: Fix FP when macros are used.
2016-01-13 20:32:40 +01:00
Lauri Nurmi
996c9244d8
Update copyright year to 2007-2016.
2016-01-01 15:34:45 +02:00
PKEuS
93c02ce826
Fixed compiler error introduced in previous commit and several MSVC warnings
2015-11-28 10:49:08 +01:00
Daniel Marjamäki
6b124a37d8
Cleanup some casts
2015-11-28 10:11:07 +01:00
Daniel Marjamäki
0f9d90d2be
Changed Copyrights. Removed my name.
2015-11-18 20:04:50 +01:00
Philipp Kloke
06c20252fa
Added dot at end of stringLiteralWrite message
2015-10-19 09:01:21 +02:00
Dmitry-Me
662e3c8b8c
Omit unneeded match checks
2015-09-07 18:35:15 +03:00
PKEuS
4d80df2f4a
Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
...
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Daniel Marjamäki
e36cc9f6d9
stringLiteralWrite: Updated error message
2015-06-05 14:34:13 +02:00
Martin Ettl
d5d6d7fbb8
Running astyle, no functional changes.
2015-05-29 20:20:05 +02:00
amai2012
5b347c537b
Fix #6720 and #6721 (Crashes on garbage code)
...
Local fixes to avoid access to NULL-token
2015-05-29 19:30:55 +02:00
Daniel Marjamäki
075b07fb6c
stringLiteralWrite: only check in function scopes
2015-05-10 10:34:13 +02:00
Daniel Marjamäki
e837bad01d
Fixed false positive in new stringLiteralWrite checker
2015-05-03 12:34:27 +02:00
Matthias Krüger
6b80e61934
fix internal warning; was
...
[lib/checkstring.cpp:43]: (warning) Found simple pattern inside Token::Match() call: "] ="
2015-05-03 10:59:58 +02:00
Daniel Marjamäki
666377da1c
Updated error message for stringLiteralWrite
2015-05-03 10:48:28 +02:00
Daniel Marjamäki
9d31afb663
Fixed #1748 (Undefined Behavior: Modification of string literal)
2015-05-03 10:44:40 +02:00