Commit Graph

310 Commits

Author SHA1 Message Date
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
orbitcowboy 87409ea6b3 Running astyle; Improved testing of std::find; std.cfg: Added support for istream::read and ifstream::read. 2016-08-25 19:17:07 +02:00
Roberto Martelloni 1db24ee070 CWE mapping of signedCharArrayIndex, unknownSignCharArrayIndex, suspiciousCase, suspiciousEqualityComparison, duplicateBranch, duplicateExpressionTernary, suspiciousSemicolon, incompleteArrayFill, redundantPointerOp, unusedLabelSwitch, unusedLabel, unknownEvaluationOrder, stlIfFind, useAutoPointerCopy 2016-08-25 15:40:23 +01:00
Daniel Marjamäki c8667096e0 Fixed #7658 (False positive: Same iterator is used with different containers) 2016-08-14 10:49:48 +02:00
Daniel Marjamäki a8df08f22b Fixed #7659 (crash: Token::varId() : vxl: brdb_selection.cxx) 2016-08-06 18:07:41 +02:00
Daniel Marjamäki 2566fd09da Fixed #5803 (False positive: Same iterator is used with different containers - insert() from range of different container) 2016-08-04 09:35:16 +02:00
PKEuS f869f7ebde Fixed false positive reademptycontainer when end() is called (#7560) 2016-07-10 10:48:21 +02:00
PKEuS 53e2cabdbb Properly support "break" in CheckVaarg::va_list_usage() (#7533)
Ran AStyle
2016-06-07 19:28:32 +02:00
Roberto Martelloni f1c39dbda7 CWE mapping of stlIfStrFind, stlcstrReturn, stlcstrParam, stlSize, (#801)
StlMissingComparison, redundantIfRemove.
2016-06-05 18:24:06 +02:00
PKEuS 64d2fd2f57 Added new attribute "arg" to <alloc> and <dealloc> to specify the argument that is allocated/deallocated.
This fixes several issues with allocation functions in windows.cfg, such as HeapAlloc() and VirtualAllocEx() (#7503)
2016-05-22 17:19:14 +02:00
PKEuS 896582ce56 Fixes for CheckStl::string_c_str():
- Fixed false positive #7480
- Fixed false negative: Show performance message also for non-local objects
2016-05-06 17:25:00 +02:00
PKEuS b7d8cd69f6 Fixed false negatives in CheckStl::string_c_str():
- Support more complex patterns (#7385)
- Use same logic for string_c_strReturn() as for string_c_strError()
2016-05-04 11:10:12 +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
Alexander Mai d12197ce1a Minor refactoring, removing a redundant condition introduced in the previous changeset 2016-02-03 12:54:44 +01:00
Alexander Mai ca2e3b9abb #7370 False positive uselessCallsCompare on unknown type. Ensure related warnings are only issued on STL types 2016-02-02 20:26:02 +01:00
Daniel Marjamäki fa31ebf88e Fixed #7349 (checker 'inefficient find()' unintentionally used for find_first_of()) 2016-01-29 08:55:46 +01:00
Daniel Marjamäki 5e10e680da CWE: refactoring. use constants instead of magic numbers. 2016-01-25 20:01:48 +01:00
Roberto Martelloni 5ce69da02d Mapped 26 errors to their CWEs ID. 2016-01-24 20:53:05 +00:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
PKEuS 940d569980 Refactorization: Removed redundant %any% patterns. 2015-12-24 14:40:48 +01:00
Alexander Mai f762affea0 Small refactoring: replace NULL by nullptr, remove redundant static keyword, Tokenizer::setVarId() uses const variable 'notstart' 2015-11-30 22:13:49 +01:00
PKEuS e8522c7883 Small refactorizations:
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
PKEuS 12af125fd3 Fixed false positive stlIfStrFind for function call inside condition.
Removed unnecessary suppressions in .travis_suppressions
2015-11-20 20:08:53 +01:00
PKEuS 6590d46013 Added missing functionality to <container> elements in Librarie, completed STL container definitions in std.cfg 2015-11-20 18:22:55 +01:00
PKEuS c0e33e20b4 Reimplemented CheckStl::readingEmptyStlContainer() based on Libraries 2015-11-20 15:53:14 +01:00
PKEuS 53b2eca983 Reimplemented CheckStl::stlBoundaries() based on Libraries; Added support for iterators to libraries 2015-11-20 15:53:14 +01:00
PKEuS 00bdc89f98 Refactorizations:
- Rely on SymbolDatabase to detect string types
- Loop over variable list instead of token list
- Fixed two comments claiming that the AST is experimental
2015-11-20 11:20:42 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 25749ab19f Fixed another crash in clang test suite and let two times two functions in std.cfg share same configuration 2015-11-15 14:55:30 +01:00
PKEuS 481d800d5a Fixed crash in clang test suite. 2015-11-15 14:40:31 +01:00
PKEuS da6b17d176 Refactorizations in CheckStl:
- Improved detection of "auto" iterators in CheckStl::iterators()
- Improved performance of CheckStl::pushback()
- Added more containers to std.cfg
2015-11-15 14:04:39 +01:00
PKEuS 32f0cbb6ad Fixed false positive eraseDereference with range-based for-loops (#7106) 2015-11-08 09:42:55 +01:00
Dmitry-Me f54f9a7d3e Explicit continue, better variable name 2015-10-14 15:06:04 +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 9085fdc156 Fixed #6887 (False positive eraseDereference - container is member of member variable) 2015-07-30 10:13:49 +02:00
Daniel Marjamäki 367eecf0db Fixed Cppcheck internal warning, simpleMatch can be used instead of Match 2015-07-23 19:13:50 +02:00
Daniel Marjamäki 3dbf290220 Refactor CheckStl::erase so it doesn't use ExecutionPath 2015-07-23 18:53:31 +02:00
Daniel Marjamäki f9d22f70db Removed simplifyIfNot simplification (#6072) 2015-07-21 20:56:47 +02:00
PKEuS 7f6b6e43b1 Support strings in CheckStl::mismatchingContainers() (#6839) 2015-07-21 14:13:26 +02:00
Alexander Mai 13c1c2c035 Refactoring (use const std::set for strings). Omit some matching for C++ stuff within C code. 2015-06-17 22:28:15 +02:00
Alexander Mai d704e97203 Fix (potential) multi-threading issues by moving static local vars (non-POD-type) to file scope 2015-06-10 21:14:17 +02:00
Alexander Mai f0bc300198 #6510 False positive performance warning for std::list::size(). Fix this and other similar false positives. Refactoring of Variable::isStlType(), use fail-safe std::set instead of plain array. Run astyle 2015-05-17 20:02:41 +02:00
PKEuS 33277c6110 Fixed false positive #6679, fixed unit test for #6663. 2015-05-11 13:10:11 +02:00
Daniel Marjamäki aab1d83075 Updated error message. write variable name. 2015-05-02 16:55:17 +02:00
PKEuS 4cbbd44d49 Fixed false positive #6663: Better support for loops in CheckStl::readingEmptyStlContainer() 2015-05-02 14:09:48 +02:00
Daniel Marjamäki dc54676289 Reverted my changes I made by mistake in previous commit 2015-05-02 14:01:31 +02:00
Daniel Marjamäki 28985d1baa manual: Document the cwe attribute 2015-05-02 11:43:42 +02:00
Daniel Marjamäki 88f59ad7e8 Partial fix for #6656 (Allow that CWE is mapped for error message) 2015-04-25 17:48:11 +02:00
Simon Martin e5745d7d4a Restore build with libc++ and revert PR#228 and PR#562. 2015-04-12 20:29:49 +02:00
Matthias Krüger 42f0955e3f Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
Follow up to eedcb6abcb .
2015-04-10 14:31:19 +02:00