Commit Graph

313 Commits

Author SHA1 Message Date
Daniel Marjamäki 9370f552ac Fixed #2134 (sizeof(*list) complains of null pointer dereference) 2010-10-26 18:26:02 +02:00
Daniel Marjamäki 893f7fa347 Fixed #2130 (Invalid possible NULL pointer dereference, etc.) 2010-10-26 17:40:30 +02:00
Daniel Marjamäki bdd6d6d53d null pointer: use simplified token list in the 'check and deref' checking 2010-10-25 21:05:43 +02:00
Daniel Marjamäki 132aa8d0c4 uninitialized variables: fixed fp when analysing loops 2010-10-25 20:56:15 +02:00
Daniel Marjamäki 026514db1a Fixed #2127 (null pointer dereference after condition (SRD nr 522)) 2010-10-25 19:43:54 +02:00
Zachary Blair 26afb04dc5 Fixed #2105 (Incorrect operator: mutual exclusion over ||) 2010-10-24 18:14:21 -07:00
Daniel Marjamäki 24a2def3ad Execution Path: Fixed FP in improved handling of loop bodies 2010-10-24 19:14:40 +02:00
Daniel Marjamäki 8f707e5e46 Null pointers: Better handling of loops 2010-10-24 18:51:14 +02:00
Daniel Marjamäki 6601de7681 uninitialized variables: refactoring handling of loop bodies 2010-10-24 18:26:59 +02:00
Daniel Marjamäki b66d3c8858 Fixed #2125 (uninitialized variable: better handling of for loops) 2010-10-24 18:12:48 +02:00
Daniel Marjamäki 92a1e9e76e Severities: Added 'warning' and 'performance' severities. No changes to the command line options nor to the XML format. Ticket: #2106 2010-10-17 14:41:00 +02:00
Debrard Sebastien fb928b6778 Fixed #2018 (Postfix Operators) 2010-10-14 19:17:40 +02:00
Pete Johns fbd3d92aa9 Fixed #2084 (False positive: object destroyed immediately (struct and function with same name))
Tightened up class definition matching so as not to match C-style struct tags.
2010-10-13 20:37:53 +11:00
Debrard Sebastien 1a4e3dcc44 increment check 2010-10-12 19:54:39 +02:00
Daniel Marjamäki 3dfcbfc0e0 assignment in assert: modified the error message to better explain the reason why the warning is given. 2010-10-11 17:59:08 +02:00
Zachary Blair d9967d4fd2 Fixed #2079 (detect side effects in assert) 2010-10-10 13:05:06 -07:00
Daniel Marjamäki 3340010376 fix unit testing 2010-10-10 14:23:05 +02:00
Daniel Marjamäki a3367874d9 Fixed #1778 (false negative: nullpointer dereference (std::string pointer)) 2010-10-09 07:57:34 +02:00
Daniel Marjamäki 7b4e08385d STL: refactoring CheckStl::erase so ExecutionPath is used 2010-10-05 20:54:13 +02:00
Pete Johns 4bf9ff26ea Fixed 2071 (false positive: object destroyed immediately (when using '= { ... }'))
Simplified check within CheckOther::checkMisusedScopedObject() as a result.
2010-10-04 08:16:11 +11:00
Daniel Marjamäki cd8ef1cded Revert "temporarily disable the 'object destroyed immediately' message"
This reverts commit fa94312c9a.
2010-10-03 18:05:08 +02:00
Daniel Marjamäki fa94312c9a temporarily disable the 'object destroyed immediately' message 2010-10-03 16:59:13 +02:00
Pete Johns 78795dc3ac Fix false positive: Misused Scope Object does not pick constructors of local class declarations.
It does pick up if there is an unused construction within the function, though.
2010-10-02 22:59:04 +10:00
Pete Johns 365b1bed1a Fixed false positive: checkMisusedScopedObject no longer errors on calls to function objects. 2010-10-02 21:25:16 +10:00
Pete Johns b72b699b76 Fixed false-positive: Object is referenced on construction
struct Foo {
        void bar() {
        }
    };

    void fn() {
        Foo().bar(); // This caused a false-positive
    }
2010-10-02 20:26:29 +10:00
Pete Johns 3f72d3a877 Check misused scope object does not pick local class method.
Also fixed mistyped withinFuntion ->withinFunction.
2010-10-02 20:12:52 +10:00
Pete Johns 0017655f55 Added test for functor false-positive [passing]
Also removed typedef's following danmar's review and renamed isClassresults -> isClassResults to make more clear.
2010-10-02 18:45:24 +10:00
Pete Johns 6e0ef3eda2 Fixed #1132 (Detection of misused scope objects in functions)
Emits error in the form:

    [useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately

    ...if an instance of a class or struct is unnamed and therefore destroyed
    straight after creation.

    Only checks for misused scope objects within functions.

    Optimised isIdentifierObjectType() by memoizing.
2010-10-02 14:22:26 +10:00
Pete Johns 50c2fa9ab0 Revert "Fixed #1132 (Detection of misused scope objects)"
This reverts commit c6acdccfa0.
2010-10-01 20:52:16 +10:00
Pete Johns c6acdccfa0 Fixed #1132 (Detection of misused scope objects)
Emits error in the form:

    [useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately

...if an instance of a class or struct is unnamed and therefore destroyed
straight after creation.

Removed "internal error" from token.cpp, since in this case varid would be NULL.
2010-10-01 20:30:21 +10:00
Daniel Marjamäki 415cbc63c3 Fixed #2066 (false positive: uninitialized variable when initializing through function pointer) 2010-09-27 19:26:09 +02:00
Daniel Marjamäki de3c761790 Fixed #2052 (False positive: possible null pointer dereference 'else continue') 2010-09-18 14:56:07 +02:00
Daniel Marjamäki fce70508f7 Fixed #2045 (False negative: Uninitialized variable (found with gcc)) 2010-09-17 20:38:37 +02:00
Daniel Marjamäki 1c3862bd35 Execution Paths: fixed TODO test cases 2010-09-17 19:31:45 +02:00
Daniel Marjamäki f843678a07 Redundant conditions: some refactorings
* removed the 'redundant null pointer' check. sometimes it's unsafe to delete NULL pointer. and this check doesn't point out errors anyway.
 * moved the 'redundant condition' check for set::remove. Moved it to CheckStl.
2010-09-16 18:49:23 +02:00
Daniel Marjamäki 7e67bb53b8 Fixed #2049 (False negative: 'Uninitialized variable' error won't show) 2010-09-15 20:04:50 +02:00
Daniel Marjamäki 0418731473 Fixed #2030 (False positive: Uninitialized variable when function does not return) 2010-09-10 19:02:40 +02:00
Daniel Marjamäki 5688412f00 Fixed #2030 (False positive: Uninitialized variable when function does not return) 2010-09-07 20:25:29 +02:00
Daniel Marjamäki cfbc06c8b6 removed 'empty catch block' check. to avoid false positives we'll need to check if it is bad with an empty catch block (dead pointer/undefined behaviour/etc) 2010-09-05 13:27:58 +02:00
Daniel Marjamäki a2b4e5641f Fixed #2010 (missing continue in switch check ?) 2010-09-04 14:24:45 +02:00
Daniel Marjamäki fb4fce466e Fixed #2014 (False positive with longjmp) 2010-09-03 07:18:01 +02:00
Daniel Marjamäki 190a0040b7 Null pointer: Fixed false positive 2010-09-02 21:08:58 +02:00
Daniel Marjamäki df87ce9e04 Fixed #1945 (False positives when a for loop header is in a macro) 2010-08-26 21:57:48 +02:00
Daniel Marjamäki 72916caee6 Reverted 7398453cb0 2010-08-15 21:25:14 +02:00
Sbastien Debrard 7398453cb0 Refactoring of obsolete functions checks. Ticket: #1940 2010-08-15 21:22:33 +02:00
Zachary Blair c8087d3389 Fixed #162 (Initialisation of a variable by itself) 2010-08-14 21:34:04 -07:00
Daniel Marjamäki 5846630fa9 Added scanf check. Modified patch submitted by Eric Sesterhenn 2010-08-14 15:15:12 +02:00
Daniel Marjamäki 029613d4c4 Fixed #1923 (False positive: Possible null pointer derefence in else if) 2010-08-07 19:59:56 +02:00
Daniel Marjamäki e7e86ef333 calculation in sizeof: added two more ASSERT_EQUALS to guard against false positives 2010-08-07 10:12:39 +02:00
Daniel Marjamäki c395e51389 New check: look for calculation inside sizeof 2010-08-06 22:57:10 +02:00