Commit Graph

7001 Commits

Author SHA1 Message Date
amai2012 99524b1f59 #6780 segmentation fault (invalid code) in Token::multiCompare. Simple fix in CheckOther 2015-06-22 11:12:46 +02:00
Alexander Mai b6858622eb #6779 internal error: division overflow. Previous error handling (see #4520) was too restrictive. 2015-06-20 23:15:35 +02:00
Alexander Mai 4172011e78 Missing update for Makefile. CheckMemoryLeakInFunction::getcode(): skip some C++ token matching in C mode. Minor refactoring 2015-06-20 22:49:28 +02:00
Alexander Mai b3c7a3f798 Fix more (potential) multi-threading issues 2015-06-20 22:26:51 +02:00
Simon Martin 7481fbb028 Fixed #6506 (Properly detect calls to the deallocating free() function) 2015-06-20 21:00:54 +02:00
Daniel Marjamäki 1d49334398 Fixed #6662 (False positive assignIfError (assignment in while condition)) 2015-06-20 16:23:16 +02:00
Martin Ettl 272cf27ec3 Improved constness of local variable, no functional changes. 2015-06-20 11:33:27 +02:00
Daniel Marjamäki 63f39ea48f Change unusedScopedObject severity from error to style. The checker does not determine that there is ub or wrong behaviour. 2015-06-20 11:22:15 +02:00
Simon Martin cba0583045 Ticket #6536: Properly handle variables whose name is that of an allocation function. 2015-06-19 23:48:40 +02:00
Daniel Marjamäki af4a4663e2 Fixed #6764 (False positive redundantCondition - !(i>1) is not i<1) 2015-06-19 19:49:05 +02:00
Daniel Marjamäki 02df692b0b Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member)) 2015-06-19 18:21:46 +02:00
Alexander Mai 712919a691 #6431 Invalid XML created - Invalid encoding of string literal. Partial fix: ensure the short message string is also processed to avoid problems with non-terminated string. 2015-06-18 21:16:25 +02:00
Alexander Mai 60f5bd97df Refactoring: missing include added, (potential) multi-threading issue fixed, expose static method to allow unit testing 2015-06-18 19:07:51 +02:00
PKEuS 189a652c2e Fixed garbage code in checkinternal.cpp 2015-06-18 17:13:46 +02:00
Matthias Krüger baaf3213e4 checkcondition: only print style message "A && (!A || B)' is equivalent to 'A || B'" if --enable=style is given. 2015-06-18 13:23:48 +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 eebb5b8c77 Fix some compiler warnings in checkio.cpp. Fix some (potential) multi-threading issues in checkinternal.cpp 2015-06-17 21:25:15 +02:00
Daniel Marjamäki a884362817 Fixed #6752 (wrong AST when there is lambda function) 2015-06-17 19:32:44 +02:00
orbitcowboy 06e818f89d Running astyle, no functional change. 2015-06-17 09:09:23 +02:00
amai2012 33d7631ee3 Fix another Borlad-specific test by setting Windows platform type
Refactoring: make CheckIO::ArgumentInfo aware of language (C vs. C++) to perform some optimizations
2015-06-16 23:11:34 +02:00
amai2012 a8db00b4bf Repair test which had to be adjusted after previous changeset.
Refactoring: Add some const
2015-06-16 22:45:33 +02:00
amai2012 919fcb38f5 Refactoring Tokenizer
Create Tokenizer::simplifyAsm2(), skip simplifyExternC() in C code and
simplifyBorland() on non-Microsoft or C code
2015-06-16 20:53:11 +02:00
Martin Ettl 9b14ab15eb MathLib::intsuffix: Added support for LLU and LU suffixes. 2015-06-16 19:12:18 +02:00
amai2012 227b48212e Skip some C++-specific simplifications in Tokenizer 2015-06-15 19:42:20 +02:00
Daniel Marjamäki 2cc23b4bb3 MathLib: Try to keep type suffix in constant calculations 2015-06-15 19:01:56 +02:00
XhmikosR 8fc4456fb4 Fix compilation error with MSVC 2013 after a7b82b5. 2015-06-15 16:06:18 +03:00
Alexander Mai a5a835b1e0 #6771 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase 2015-06-14 22:18:28 +02:00
Daniel Marjamäki d571d5db6f Fixed compiler warning -Wfloat-equal in template when type is double and there is equality comparison 2015-06-14 20:25:52 +02:00
Daniel Marjamäki 1e1ba6b4a9 Fixed #6574 (False positive oppositeInnerCondition - unknown variable) 2015-06-14 20:06:05 +02:00
Alexander Mai 70ba6c4340 #6767 False positive: memory leak when variable name is 'new'. Fix handling of new in C code. Move some tests for TokenList to new testtokenlist.cpp 2015-06-14 15:49:49 +02:00
Alexander Mai a7b82b5c28 Refactoring to address some issues from #5895 (handling of unsigned numbers). Also adding a TODO testcase since the real issue (FP) is still not fixed 2015-06-13 18:08:13 +02:00
Alexander Mai 40d7baa6bb Fix more (potential) multi-threading issues by moving static local vars (non-POD-type) to file scope 2015-06-13 16:22:43 +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
Daniel Marjamäki 3986c0dc64 fixed cppcheck warnings 2015-06-10 19:07:04 +02:00
Dmitry-Me cae605b1ec New warning: warn about redundant code in condition. 2015-06-10 18:53:55 +02:00
Frank Zingsheim 0e354a03bd Fixed #6716 (Performance: Alternative String Representation in Match Compiler) 2015-06-07 16:21:06 +02:00
Daniel Marjamäki 0ca410a4d7 Fixed #6668 (False positive bufferAccessOutOfBounds on sprintf() - regression) 2015-06-07 14:01:20 +02:00
Alexander Mai c18461b173 #6761 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash. 2015-06-07 13:35:51 +02:00
Daniel Marjamäki 75b0430ba5 Token::strValue: fixed handling of backslash 2015-06-07 11:25:33 +02:00
Alexander Mai b6264e4a00 #6759 segmentation fault (invalid code) in Tokenizer::simplifyTokenList2. #6760 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crashes 2015-06-06 13:11:32 +02:00
Daniel Marjamäki d208e763df astyle formatting 2015-06-05 14:34:53 +02:00
Daniel Marjamäki e36cc9f6d9 stringLiteralWrite: Updated error message 2015-06-05 14:34:13 +02:00
amai 5fd9dd04fa #6757 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash 2015-06-04 19:00:35 +02:00
Alexander Mai 5f4902c613 6755 segmentation fault (invalid code) in Token::isAssignmentOp. #6756 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix two crashes. 2015-06-04 17:46:52 +02:00
amai2012 f2d397882f #6753 segmentation fault (invalid code) in CheckMemoryLeakStructMember::checkStructVariable. #6754 segmentation fault (invalid code) in CheckUnusedVar::checkFunctionVariableUsage_iterateScopes. Trivial fixes to avoid null pointer access 2015-06-03 17:17:53 +02:00
amai2012 87bf09c0ae #6751 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. 2015-06-03 11:39:30 +02:00
amai2012 ed5a4127e8 #6749 segmentation fault (invalid code) in Tokenizer::copyTokens. #6750 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. 2015-06-03 10:39:19 +02:00
amai2012 d36c84553f #6748 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Throw error from now (member-function) Tokenizer::processFunc 2015-06-03 08:59:38 +02:00
Alexander Mai d86ac9e3ed #6747 segmentation fault (invalid code) in Token::isAttributeConstructor 2015-06-02 22:26:17 +02:00
Alexander Mai 09f2cff519 #6746 segmentation fault (invalid code) in Tokenizer::simplifyTypedef 2015-06-02 21:52:08 +02:00
Alexander Mai 6e1b5a0a53 #6744 segmentation fault (invalid code) in Tokenizer::simplifyPointerToStandardType. #6745 segmentation fault (invalid code) in Tokenizer::simplifyTypedef 2015-06-02 21:20:41 +02:00
Alexander Mai 454d4573b4 #6742 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase. Fix in Type::initBaseInfo() 2015-06-02 20:15:21 +02:00
Alexander Mai f348c8eebe #6741 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. 2015-06-02 20:09:12 +02:00
Alexander Mai 7fc9930b38 #6740 segmentation fault (invalid code) in Tokenizer::simplifyFunctionPointers. Throw syntaxError instead 2015-06-02 19:48:20 +02:00
Alexander Mai a3bdd90df5 #6739 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix segfault in the specified method 2015-06-02 19:40:20 +02:00
Alexander Mai be3690920a #6738 Avoid segfault on garbage code in Tokenizer::simplifyTypedef() 2015-06-02 19:07:26 +02:00
amai2012 7895f1c2bb #6737 Avoid segfault on garbage code inside Type::initBaseInfo. Disable test TestGarbage::garbageCode58() for #6732 since it triggers memory corruption still 2015-06-02 18:28:43 +02:00
Martin Ettl 0a148a9433 Running astyle, no functional changes. 2015-06-01 22:09:56 +02:00
amai2012 4b2fb4b76c #6735, #6735 Fix segfault on garbage code
Throw syntax error instead
2015-06-01 21:47:06 +02:00
Daniel Marjamäki 4bde4d5a4a updated style messages 2015-06-01 21:22:47 +02:00
Alexander Mai fb2bd978ad #6732 segmentation fault (invalid code) in Tokenizer::simplifyEmptyNamespaces. Add testcase, segfault seems to have been fixed by previous commit. Run astyle 2015-06-01 13:46:13 +02:00
amai2012 b81e82d462 #6733 segmentation fault (invalid code) in Tokenizer::simplifyAddBracesPair
Avoid access to NULL-token by throwing an InternalError
2015-06-01 13:27:32 +02:00
Frank Zingsheim 6857dbe864 #6729 Simplification reference to constants. 2015-06-01 10:00:03 +02:00
Simon Martin 519bd7007a Ticket #6588: Properly detect whether the condition in a ternary operator is constant on C input. 2015-05-31 22:40:13 +02:00
Simon Martin 85b47636dc Simplify known variableswhen they are at the end of a statement. 2015-05-30 23:34:50 +02:00
orbitcowboy 9c6ce2b06b Merge pull request #605 from simartin/no_space_in_decl
Removed useless space in the declaration for Tokenizer::Simplifyfunctionpointers
2015-05-30 21:22:14 +02:00
Simon Martin c73876b3a8 Removed useless space in the declaration for Tokenizer::Simplifyfunctionpointers. 2015-05-30 21:00:41 +02:00
Simon Martin 98e6dca4f2 Ticket #6713: Properly detect ternary operator in valueFlowForward. 2015-05-30 20:55:36 +02:00
Alexander Mai ddc80246c2 #6724 segmentation fault (invalid code) Token::isAttributeConstructor. Local fix to avoid access to NULL-token 2015-05-30 19:15:53 +02:00
Alexander Mai 4050d56169 #6722 segmentation fault (invalid code) in Tokenizer::simplifyTypedef 2015-05-29 21:44:00 +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
Martin Ettl 9236ea4a20 Running astyle, no functional changes. 2015-05-29 19:15:41 +02:00
amai2012 e41beb4f8d Fix #6718 and #6719 (crashes on garbage code).
Local fixes avoiding access to NULL-token.  Also minor correction to
TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates()
2015-05-29 18:34:00 +02:00
Alexander Mai 098391ee32 #6715 segmentation fault (invalid code) in TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates. Harden TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates() 2015-05-28 21:38:20 +02:00
Alexander Mai 8adff0a31b #6712 segmentation fault (invalid code) in CheckExceptionSafety::checkRethrowCopy. Local fix to avoid accessing NULL-token 2015-05-28 21:12:02 +02:00
Alexander Mai 133d8f9a91 #6706 segmentation fault (invalid code) in tokenlist::compilePrecedence3. Local fix to prevent acess to NULL-token 2015-05-27 21:39:31 +02:00
Alexander Mai 94d376e228 Merge branch 'master' of https://github.com/danmar/cppcheck 2015-05-27 21:13:18 +02:00
Alexander Mai e498f8493e #6705 segmentation fault (invalid code) in CheckVaarg::va_list_usage. Local fix i nchecker preventing SIGSEGV on NULL-token 2015-05-27 21:12:33 +02:00
Daniel Marjamäki 22c608dd2c Reverted fix for #6710. It didnt work as I wanted. 2015-05-27 20:50:03 +02:00
Daniel Marjamäki 0836bf3d33 astyle formatting 2015-05-27 20:26:26 +02:00
Daniel Marjamäki 152ea116fa Fixed #6710 (valueFlowBeforeCondition: function call in loop seems to cause FN) 2015-05-27 20:25:58 +02:00
Simon Martin 50e5595845 Ticket #6708: Check that a function name is not a reserved keyword in SymbolDatabase::isFunction instead of later. 2015-05-26 00:28:08 +02:00
amai2012 729b240d9c Refactoring (compiler warnings and a typo) 2015-05-25 23:15:59 +02:00
Alexander Mai d4550c763d Exit code shall indicate that an internal error (syntax error) has been found. Add some const. Run astyle 2015-05-25 21:15:55 +02:00
amai2012 f1c4cc6d55 Merge pull request #598 from simartin/useless_str_check
Removed unnecessary string comparison in Tokenizer::simplifyKnownVariablesSimplify
2015-05-25 19:13:33 +02:00
Daniel Marjamäki a8d7897471 Fixed travis failure 2015-05-25 18:19:40 +02:00
Daniel Marjamäki a9db06c641 longCast: Only warn when original name is 'long'. avoids some FPs when typedef types are used. 2015-05-25 18:06:20 +02:00
Daniel Marjamäki c0b33d2fef Fixed #6707 (new check: possible truncation when assigning int result to long) 2015-05-25 10:02:17 +02:00
Alexander Mai e28e9be82f Add TODO testcase for #5738. Refactoring: add some const 2015-05-25 08:20:14 +02:00
Daniel Marjamäki eb0db322eb Fixed #6560 (ValueFlow: handling ternary operator better in valueFlowSubFunction) 2015-05-24 17:02:00 +02:00
Simon Martin c58fab07d6 Removed unnecessary string comparison in Tokenizer::simplifyKnownVariablesSimplify. 2015-05-24 13:13:46 +02:00
Alexander Mai 7f15873759 Refactoring in tokenize.cpp: Fix cppcheck warning, add some const, fix typo from previous refactoring 2015-05-24 11:43:46 +02:00
Alexander Mai 7002f9df35 Merge branch 'master' of https://github.com/danmar/cppcheck 2015-05-24 09:43:52 +02:00
Alexander Mai 394160184a Refactoring: Replace complex if/else cascade by search in a container. Remove redundant plain arrays (in favour of container) 2015-05-24 09:43:17 +02:00
Simon Martin 26f244e638 Ticket #6704: Tighten pattern skipping base class declarations and fix crash upon garbage code. 2015-05-24 08:16:34 +02:00
Simon Martin 898ba783bf Ticket #6703: Rewrite pattern in SymbolDatabase to avoid crash upon garbage code. 2015-05-23 23:18:59 +02:00
Alexander Mai 7416d6add9 Another fix for handling of final/override specifiers in Tokenizer::simplifyKeyword() including a testcase. Ran astyle 2015-05-23 20:51:15 +02:00
amai2012 7c23f4e611 Merge pull request #596 from simartin/ticket_6620-6685
Ticket #6620, #6685: Reserved keywords cannot be function names.
2015-05-23 13:47:07 +02:00
Alexander Mai e8d84bc6b4 #6700 const vs non-const inside assert() statement. Function matching in symboldatabase did not honor const'ness of a class instance variable 2015-05-23 11:56:11 +02:00