Commit Graph

294 Commits

Author SHA1 Message Date
Roberto Martelloni 04f24b4220 CWE mapping of accessMoved, accessForwarded, nullPointerArithmeticRedundantCheck, nullPointerArithmetic 2016-12-24 23:07:37 +00:00
Matthias Krüger 01e5f14bf8 CheckClass::virtualDestructorError and a variation of CheckNullPointer::nullPointerError would print inconclusive,warning messages altough no --enable=warning was given. Fix. 2016-11-23 00:13:09 +01:00
Daniel Marjamäki af5dd2c29e New check: Pointer overflow (null pointer subtracted) 2016-10-09 15:15:29 +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 01ee9ee5e6 CWE mapping of invalidLengthModifierError, leakUnsafeArgAlloc, nullPointerDefaultArg, nullPointerRedundantCheck, raceAfterInterlockedDecrement. 2016-08-24 15:37:14 +01:00
Dmitry-Me 224e55780e Add const where const access is enough 2016-07-22 15:35:07 +03:00
Daniel Marjamäki 4b903a838f Fixed #5522 (CheckLeakAutoVar: Don't treat 'x==p' as dereference of p) 2016-05-26 19:22:38 +02:00
PKEuS 923f7f843d Better distinguishing between possible and known null pointer dereferenciations (#7157) 2016-01-30 20:43:40 +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
Daniel Marjamäki 4a3ece5847 CheckNullPointer: Fix FP for 'buf[p]' when p is NULL 2016-01-20 08:42:58 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02: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
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Frank Zingsheim 1fd9ba0cc4 Fixed #6988 (incorrect nullPointer error for string) 2015-09-13 10:53:05 +02:00
PKEuS ab8afec3eb Refactorizations:
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02: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 6790d91fbb Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884. 2015-07-29 19:54:57 +02:00
PKEuS d45021673e Assign different IDs for different nullPointer messages (#6166) 2015-07-23 14:53:18 +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 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
Daniel Marjamäki 88f59ad7e8 Partial fix for #6656 (Allow that CWE is mapped for error message) 2015-04-25 17:48:11 +02:00
Daniel Marjamäki bdc024bd7c Fixed 6634 (false positive: dereferencing null pointer in a sizeof operation) 2015-04-20 13:46:02 +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
Matthias Krüger eedcb6abcb move setting flags checks out of for loops, make them const. 2015-04-07 07:23:28 +02:00
Matthias Krüger 7fdbb91694 don't print warning message if --enable=warning is not specified.
message was of type:
(warning) Possible null pointer dereference: previous - otherwise it is redundant to check it against null.
2015-04-06 15:05:34 +02:00
Daniel Marjamäki fd6bd97972 Fixed #6495 (Improve check: uninitialized variable, 3rd function argument) 2015-03-14 19:23:33 +01:00
PKEuS 451a277b18 Refactorization: Support function default values in ValueFlow, removed now obsolete CheckNullPointer::nullPointerDefaultArgument().
-> Use valueFlowForward() to parse values passed to functions
-> valueFlowForward(): Set value in first occurrence of a variable in a condition
2015-02-01 15:15:00 +01:00
PKEuS b2835051df Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0. 2015-01-31 12:32:04 +01:00
Thomas Jarosch 332254e0af Make patterns compilable (mini refactoring) 2015-01-09 23:43:45 +01:00
Daniel Marjamäki 6a8293a8b7 Library: More strict matching of functions 2015-01-08 19:31:41 +01:00
Robert Reif ba1c24ee65 Fixed #6422 (symbol database: put function flags into a single flag variable) 2015-01-08 05:45:31 +01:00
Daniel Marjamäki fe8d04e840 CheckNullPointer: Fix FP when x is NULL and address is calculated with expression '&x->y.z[0]' 2015-01-05 14:54:24 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS c4fd8919a2 Fixed #6014: Added plausibility check before issuing null pointer messages on function calls defined in library 2015-01-02 13:35:39 +01:00
PKEuS 8b59c39c42 Refactorization: Removed whitespaces at the end of Token::Match patterns 2014-12-27 11:09:54 +01:00
PKEuS 079f495455 Added missing relational operators to pattern, as suggested in #6189 2014-10-16 20:37:21 +02:00
PKEuS a99fd364ef Restored functionality to detect std::string(0) calls as null pointer dereferences (#6189) 2014-10-16 19:12:02 +02:00
Alexander Mai 21c85118d6 #6189 assign with operator= a '\0' to a std::string is not an error 2014-09-26 20:40:44 +02:00
Dmitry-Me a2b30c7801 Detect -> accesses on uninitialized pointers 2014-09-12 10:19:00 +04:00
Dmitry-Me f7824bfd00 CheckNullPointer::isPointerDeRef: Improve handling of static member variables and functions 2014-09-09 05:36:09 +02:00
PKEuS e8f7279039 Refactorization: Moved detection of STL strings to SymbolDatabase 2014-09-05 12:03:08 +02:00
PKEuS 5483c8ed5e Removed obsolete function from checkNullPointer 2014-08-18 11:42:50 +02:00
Daniel Marjamäki 76510e0006 null pointer: perform proper null pointer checking when no --enable=warning is given. 2014-08-16 12:48:20 +02:00
amai2012 0ddd7752b5 Avoid crash reported in #5943 (using the example from duplicate ticket #5971)
Replace a few size_t/unsigned int by std::size_t
2014-07-06 14:48:24 +02:00
PKEuS ac4e727da7 Removed redundant code (replaced by libaries, should fix #5934). 2014-06-24 21:57:19 +02:00
Daniel Marjamäki f78cbda2db Refactoring: Removed CheckNullPointer::nullPointerByCheckAndDeRef and implemented needed analysis in ValueFlow instead. 2014-06-22 10:02:14 +02:00
PKEuS 9dd4ac68c0 Refactorization in CheckNullPointer:
- Use AST to detect dereferences
- Added more unit tests
- Removed handling of unknown constructs in CheckNullPointer::isPointerDeRef()

Added link to verbose message cstyleCast.
2014-05-22 19:48:00 +02:00
orbitcowboy ac8d283afb Fixed CID 1214638: Dereference before null check (REVERSE_INULL). 2014-05-12 17:18:51 +02:00