Commit Graph

921 Commits

Author SHA1 Message Date
Daniel b80a954f55 Fixed #844 (Tokenizer: Simplify 'sizeof *ptr' correctly) 2009-10-21 21:08:00 +02:00
Reijo Tomperi 9d42194562 Fix #767 (Tokenizer: Known variable variable not simplified)
http://sourceforge.net/apps/trac/cppcheck/ticket/767
2009-10-20 23:58:46 +03:00
Daniel e5f13b4de2 Fixed #839 (False positive: possible null pointer dereference after new) 2009-10-20 20:57:38 +02:00
Reijo Tomperi 6fbf873d25 Improved countSprintfLength() to detect more errors with %d.
Fixed some errors from test cases.
Added more test cases.
2009-10-20 00:48:29 +03:00
Daniel Marjamäki a36c31628d Fixed by #828 (Exception Safety: No throwing in destructors) 2009-10-19 20:57:11 +02:00
Daniel Marjamäki 857c95e7b5 Null pointers: Detect code where the assignment is conditional 2009-10-19 17:32:43 +02:00
Daniel Marjamäki 0e56e4cd37 STL: checking that containers are matching 2009-10-18 18:42:01 +02:00
Daniel Marjamäki 50e542c183 Fixed #827 (Tokenizer: sizeof is incorrectly simplified) 2009-10-18 18:06:32 +02:00
Daniel Marjamäki 58790eda82 Fixed #449 (false postive:: resource leak when using errno) 2009-10-18 13:17:05 +02:00
Reijo Tomperi aca743c9ed Fix #826 (False positive: sprintf with "f%s")
http://sourceforge.net/apps/trac/cppcheck/ticket/826
2009-10-18 13:58:48 +03:00
Daniel Marjamäki cb76061118 unused struct member: bail out when casting 2009-10-17 19:31:14 +02:00
Daniel Marjamäki 2ec1b676ea Pointer Aliasing: Handle pointer aliasing through the Tokenizer::simplifyKnownVariables 2009-10-17 18:21:13 +02:00
Daniel Marjamäki 2e9f7755ee Unused struct members: bail out upon casting 2009-10-17 17:36:55 +02:00
Daniel Marjamäki ffbf8e38ac stl: after vector::insert, iterators may become invalid 2009-10-15 21:29:56 +02:00
Daniel Marjamäki 01af70cc88 Fixed #823 (Buffer overrun with memcpy) 2009-10-15 19:36:48 +02:00
Daniel Marjamäki 91de8f399b Fixed #821 (Preprocessor: Wrong stringification in macros) 2009-10-14 20:40:17 +02:00
Reijo Tomperi be90d34962 Buffer overrun errors behind function call should be possible errors. 2009-10-14 00:09:37 +03:00
Reijo Tomperi 3dc45903bc Move buffer overrun errors behind --all
Fix one possible error issue with arrayindexoutofbounds
Make sure that possible errors are not shown without --all
2009-10-13 23:33:41 +03:00
Reijo Tomperi a3a55547d8 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-10-13 22:41:21 +03:00
Reijo Tomperi 4036dd5eff arrayIndexOutOfBounds check is now done without --all
Errors with buf[1] are still listed only with --all due to false positive risk in them.
2009-10-13 22:39:51 +03:00
Daniel Marjamäki a33b4744a3 stl: better checking for invalid iterator after push_back 2009-10-13 20:55:33 +02:00
Daniel Marjamäki ed3860a0a7 Fixed #805 (False positive: Member functions not handled correctly) 2009-10-12 21:36:28 +02:00
Reijo Tomperi b6999d010f Fix #812 (False positive: sprintf with "%.4s" with --all)
http://sourceforge.net/apps/trac/cppcheck/ticket/812
2009-10-11 22:07:18 +03:00
Reijo Tomperi 59aad35137 Fix #694 (False (possible error) Buffer overrun with %-1s)
ashim2009 did most of the work
http://sourceforge.net/apps/trac/cppcheck/ticket/694
2009-10-11 21:36:22 +03:00
Reijo Tomperi 1401e3f668 Fix #810 (false positive: Division with signed and unsigned operators)
http://sourceforge.net/apps/trac/cppcheck/ticket/810
2009-10-11 17:52:35 +03:00
Reijo Tomperi ea36632ca3 Fix #808 (Segfault in Preprocessor)
http://sourceforge.net/apps/trac/cppcheck/ticket/808
2009-10-10 23:23:48 +03:00
Slava Semushin 237dcb9533 Fixed #809 (Tokenizer: don't replace sizeof() of unknown type to zero)
http://sourceforge.net/apps/trac/cppcheck/ticket/809
2009-10-10 19:26:03 +07:00
Daniel Marjamäki b67fe861b8 Added testcase for #807 (cppcheck crashes scanning ruby 1.9.1) 2009-10-10 10:13:56 +02:00
Daniel Marjamäki 67f53661a9 Fixed #806 (cppcheck crashes scanning openssl) 2009-10-09 21:11:29 +02:00
Reijo Tomperi a078c9353d More test cases for sprintf counter 2009-10-08 17:36:00 +03:00
Reijo Tomperi 5eee9af974 sprintf counter improvements 2009-10-08 16:27:46 +03:00
Reijo Tomperi ad5d87ee14 Fix #802 (possible null pointer dereference reported for reference)
http://sourceforge.net/apps/trac/cppcheck/ticket/802
2009-10-08 11:55:37 +03:00
Reijo Tomperi 014ad937cf Optimize speed and fix one false positive with stl checks. 2009-10-07 23:38:21 +03:00
Reijo Tomperi 52ca36a6ed Added more test cases for sprintf counter 2009-10-07 21:33:44 +03:00
Daniel Marjamäki 13e43b8710 Ashim Kapoor: updated the counter (#694) 2009-10-07 18:21:44 +02:00
Reijo Tomperi fcd269dbf7 Refactoring: Moved some code into a new function.
Renamed count->countSprintfLength.
Added code to collect sprintf parameters.
Added a few TODO test cases.
2009-10-07 15:37:20 +03:00
Reijo Tomperi 8fc21dda27 Fix #801 (Tokenizer: Simplify sizeof for function parameters)
http://sourceforge.net/apps/trac/cppcheck/ticket/801
2009-10-07 12:05:44 +03:00
Reijo Tomperi 06dd66bff4 Fix #487 (Tokenizer: Simplify sizeof for string array and string pointer)
http://sourceforge.net/apps/trac/cppcheck/ticket/487
2009-10-07 11:08:53 +03:00
Reijo Tomperi 8472e58413 Refactored sizeof simplification and fixed one TODO assert. 2009-10-07 10:54:34 +03:00
Reijo Tomperi d9ae2c171e Detect referenced by value errors for std::map also. 2009-10-07 00:04:54 +03:00
Reijo Tomperi ab762b1a00 Fix #388 (resource leak not detected, allocation through function call)
http://sourceforge.net/apps/trac/cppcheck/ticket/388
2009-10-06 23:14:32 +03:00
Reijo Tomperi 2e69d50458 Fix #796 (segmentation fault while scanning)
http://sourceforge.net/apps/trac/cppcheck/ticket/796
2009-10-06 21:03:15 +03:00
Daniel Marjamäki 36fb24b1a5 memory leaks: don't write errors for static member variables 2009-10-06 18:25:00 +02:00
Daniel Marjamäki c3d56c1d13 Fix #797 (false positive: variable scope when using function call) 2009-10-06 17:45:28 +02:00
Reijo Tomperi d598bed1c6 Fix #575 (Array index out of bounds check: get address of one-past-the-end array is legal)
http://sourceforge.net/apps/trac/cppcheck/ticket/575
2009-10-06 14:50:27 +03:00
Reijo Tomperi c55140d4cd Fix #580 (double free not found)
http://sourceforge.net/apps/trac/cppcheck/ticket/580
2009-10-06 12:44:53 +03:00
Reijo Tomperi 13fbd616da Moved some test cases from testtokenize into testsimplifytokens and added one TODO case. 2009-10-06 12:40:50 +03:00
Reijo Tomperi 272f0d3be5 Fix #795 (Preprocessor: Incorrect handling of #if (A) || (B))
http://sourceforge.net/apps/trac/cppcheck/ticket/795
2009-10-06 11:47:36 +03:00
Reijo Tomperi 0a7da96cb6 Fix #765 (divsion by zero not detected in std::cout stream)
http://sourceforge.net/apps/trac/cppcheck/ticket/765
2009-10-06 09:14:59 +03:00
Reijo Tomperi 1eba4b374f Fix #794 (Floating point exception on CheckBufferOverrun)
http://sourceforge.net/apps/trac/cppcheck/ticket/794
2009-10-05 23:19:44 +03:00
Reijo Tomperi edb28d2856 Fix #365 (Improve simplifyQuestionMark() in tokenize.cpp)
http://sourceforge.net/apps/trac/cppcheck/ticket/365
2009-10-05 17:34:38 +03:00
Reijo Tomperi 6901bcae79 Fix #771 (False positive. Null pointer dereference in a switch case)
http://sourceforge.net/apps/trac/cppcheck/ticket/771
2009-10-05 14:46:38 +03:00
Reijo Tomperi 036f3894f1 Fix simplifyRedundantParanthesis() to work after '}' 2009-10-05 14:30:05 +03:00
Reijo Tomperi 5a0a5422c3 Fix #776 (Tokenizer: remove useless brackets around variable assignment)
http://sourceforge.net/apps/trac/cppcheck/ticket/776
2009-10-05 14:22:35 +03:00
Reijo Tomperi fc684d7b5a Fix #778 (Tokenizer: impove simplification inside if())
http://sourceforge.net/apps/trac/cppcheck/ticket/778
2009-10-05 14:10:09 +03:00
Reijo Tomperi 1df8f38423 Fix #793 (Improve passedByValue check)
http://sourceforge.net/apps/trac/cppcheck/ticket/793
2009-10-05 11:59:28 +03:00
Reijo Tomperi 8bb812548c Fix #777 (Tokenizer: double casting simplified incorrectly)
http://sourceforge.net/apps/trac/cppcheck/ticket/777
2009-10-05 00:12:12 +03:00
Reijo Tomperi 498beb7d9a Fix #784 (Tokenizer: Simplify 2[a] -> a[2])
http://sourceforge.net/apps/trac/cppcheck/ticket/784
2009-10-04 23:33:41 +03:00
Daniel Marjamäki 23d8937661 Fixed #789 (false positive: resource leak reported when using for loop) 2009-10-04 19:58:41 +02:00
Daniel Marjamäki ab18f1bd3c Preprocessor: Minor fixes (#772) 2009-10-04 15:41:50 +02:00
Daniel Marjamäki 6b1fae75e5 Fixed #785 (False positive: resource leak of extern FILE*) 2009-10-04 14:24:41 +02:00
Daniel Marjamäki af5a695f82 Fixed #727 (False positive: Resource leak when release is done inside function call) 2009-10-04 13:10:08 +02:00
Slava Semushin 6b0d364f57 Fixed #782 (Checks are missing test cases)
http://sourceforge.net/apps/trac/cppcheck/ticket/782
2009-10-04 15:05:58 +07:00
Daniel Marjamäki ee1bcb728c use '<' comparisons instead of '>' (#610) 2009-10-04 07:51:12 +02:00
Daniel Marjamäki 1a48f869c8 Fixed #772 (Preprocessor: #if(A) is not seen equal to #if A) 2009-10-04 07:25:30 +02:00
Daniel Marjamäki 4387071eb1 Fixed #733 (New check: locking & unlocking mutex and semaphore variables) 2009-10-03 21:46:22 +02:00
Slava Semushin b0d8b6ca8b Fixed #780 (Tokenizer: replace typedef for pointers to struct)
http://sourceforge.net/apps/trac/cppcheck/ticket/780
2009-10-03 22:02:23 +07:00
Slava Semushin 9983066f62 Fixed #770 (Tokenizer: Var id not set for static variables in some cases)
http://sourceforge.net/apps/trac/cppcheck/ticket/770
2009-10-03 17:05:07 +07:00
Reijo Tomperi 107895e8cc TODO test cases TestTokenizer::vardec_static added 2009-10-02 17:28:30 +03:00
Daniel Marjamäki 57067f6627 memory leaks: refactoring unit tests 2009-10-01 22:25:59 +02:00
Daniel Marjamäki e894e37131 Fixed #679 (False positive: Unused private function produced by exception specification) 2009-10-01 19:45:48 +02:00
Reijo Tomperi b3ad712b61 Fix #421 (Memory leak not found when typeid() is used.)
http://sourceforge.net/apps/trac/cppcheck/ticket/421
2009-10-01 11:56:59 +03:00
Reijo Tomperi 4650e513e1 Fix #741 (False positive: Buffer overrun with -a when index increased in multiple locations)
http://sourceforge.net/apps/trac/cppcheck/ticket/741
2009-10-01 11:33:53 +03:00
Reijo Tomperi d4a97eb2b4 Fix #419 (missleading buffer overrun)
http://sourceforge.net/apps/trac/cppcheck/ticket/419
2009-10-01 10:59:27 +03:00
Reijo Tomperi 39092150e2 Fix #763 (Tokenizer: Goto incorrectly simplified)
http://sourceforge.net/apps/trac/cppcheck/ticket/763
2009-10-01 10:25:32 +03:00
Daniel Marjamäki e3e8224b4e memory leaks: fixed TODO_ASSERT_EQUALS 2009-09-30 22:27:00 +02:00
Reijo Tomperi f9871c2d54 Fix #745 (false positive: possible null pointer dereference , while)
http://sourceforge.net/apps/trac/cppcheck/ticket/745
2009-09-30 21:42:14 +03:00
Reijo Tomperi ec44f8f6c7 Fix #744 (False positive: (possible error) Array index out of bounds)
http://sourceforge.net/apps/trac/cppcheck/ticket/744
2009-09-30 15:51:33 +03:00
Reijo Tomperi 6ed727564c Fix #759 (Tokenizer: Incorrect var id when two variables with same name)
http://sourceforge.net/apps/trac/cppcheck/ticket/759
2009-09-30 14:40:10 +03:00
Reijo Tomperi 7852d38f54 Fix #761 (Tokenizer: typedef inside class is incorrectly simplified)
http://sourceforge.net/apps/trac/cppcheck/ticket/761
2009-09-30 14:35:00 +03:00
Reijo Tomperi bb1a9a07e4 Fix #760 (Tokenizer: Goto not simplified)
http://sourceforge.net/apps/trac/cppcheck/ticket/760
2009-09-30 14:30:53 +03:00
Reijo Tomperi 500dedb8a3 Added TODO test cases: simplifyTypedef, simplifyTypedef2, simplifyTypedef3 2009-09-30 10:11:09 +03:00
Reijo Tomperi 724c78fb4d Fix #750 (cppcheck wants variable outside do-loop to be only inside loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/750
Fix #758 (False positive on variable scope with boost foreach)
http://sourceforge.net/apps/trac/cppcheck/ticket/758
2009-09-30 00:56:43 +03:00
Daniel Marjamäki e5bc4a02ae added a TODO_ASSERT_EQUALS for the counter 2009-09-29 20:50:22 +02:00
Reijo Tomperi 1b1047a5e4 Fix #757 (Change message: (style) The class 'KClass' has no constructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/757
2009-09-29 21:27:17 +03:00
Reijo Tomperi 77d677dd59 TODO test case for count() added 2009-09-29 18:51:29 +03:00
Daniel Marjamäki 12b29e35ad Ashim Kapoor: deal with backspace better (#694) 2009-09-29 17:02:19 +02:00
Reijo Tomperi ededbfb10e Fix comment in test case 2009-09-29 17:19:56 +03:00
Reijo Tomperi 63523316a2 Check nullpointer check is now executed without --style flag
Added TODO test case for nullpointer check
2009-09-29 16:38:05 +03:00
Reijo Tomperi 64f0f3b308 Fix #751 (if-condition considered redundant even with else-branch)
http://sourceforge.net/apps/trac/cppcheck/ticket/751
Fix also other issue with if(a.b) delete c.b;
Fix also other issue with if(a.b.c) delete a.b.c;
2009-09-29 00:18:40 +03:00
Daniel Marjamäki 311f6dc92e Fixed #746 (False positive, Memory leak when goto is used) 2009-09-28 22:58:06 +02:00
Daniel Marjamäki 1427f0a2c7 memory leaks: fixed a TODO_ASSERT_EQUALS for a false positive 2009-09-28 22:41:45 +02:00
Reijo Tomperi 2d4404f030 Fix #754 (Tokenizer: transform modifier "signed" to "int")
http://sourceforge.net/apps/trac/cppcheck/ticket/754
Also fix int unsigned -> unsigned int
2009-09-28 21:25:05 +03:00
Slava Semushin b9237db9a3 Fixed #753 (Tokenizer: don't simplify variables inside do {} while loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/753
2009-09-28 22:15:31 +07:00
Daniel Marjamäki a1e20290cd Refactoring the unit testing of format strings 2009-09-27 22:13:15 +02:00
Daniel Marjamäki a61abcbbc8 Fixed #728 (False positive, resource leak, when released in a loop) 2009-09-27 21:49:07 +02:00
Slava Semushin e8c83613e4 Fixed #740 (False positive, buffer overrun with --all)
Regression since 07f41f4563 commit.

http://sourceforge.net/apps/trac/cppcheck/ticket/740
2009-09-27 22:50:59 +07:00
Slava Semushin 661ce78b69 Fixed #738 (False Buffer overrun with -a when i is increased by more than 1 inside loop body)
http://sourceforge.net/apps/trac/cppcheck/ticket/738
2009-09-27 22:14:51 +07:00
Reijo Tomperi fdde2182b9 Fix GPL comments in all files. ">." was missing from the end. 2009-09-27 18:08:31 +03:00
Slava Semushin 07f41f4563 Fixed #714 (False Buffer overrun with -a when i is increased by more than 1 in a loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/714
2009-09-27 21:12:46 +07:00