Thomas Jarosch
3413ffef3e
Refactor readlink() buffer check to also handle readlinkat()
2011-10-24 21:23:18 +02:00
Marek Zmysłowski
b332ea8222
Fixed #3204 (Refactor standards support in Settings)
2011-10-22 09:45:48 +02:00
Thomas Jarosch
a52b73f9f9
Fix #3208 (Simplify pointer to standard type, C only)
...
The symbol database is unavailable during token simplification
and &data[0] might return something completely different for C++.
Moved code_is_c() from checkOther to Tokenizer.
2011-10-16 08:09:57 +02:00
Thomas Jarosch
7ae39f13cc
Fixed #3198 (Add check for readlink())
2011-10-14 19:45:51 +02:00
Daniel Marjamäki
6f8e42a5af
changed the astyle formatting flags
2011-10-13 20:53:06 +02:00
Daniel Marjamäki
b73896bcc5
Fixed #3163 (Out of bounds pointer arithmetic not reset)
2011-10-12 20:54:39 +02:00
Thomas Jarosch
abd2525339
Fixed #3161 (Show buffers size info for snprintf() buffer overruns)
2011-10-05 20:17:57 +02:00
Robert Reif
65b0fb4519
fix #3153 (false positive buffer access out-of-bounds)
2011-09-30 17:28:59 -04:00
Robert Reif
ac070b90f2
fix for loop false positives when zero length arrays present
2011-09-22 21:23:40 -04:00
Robert Reif
b349d36c50
fix #3124 (FP: Buffer access out-of-bounds when memset two dimension array (a[5][6]))
2011-09-19 20:32:50 -04:00
Robert Reif
3f517b5f23
partial fix for #2960 (false negative: buffer access out of bounds)
2011-09-11 21:51:05 -04:00
Robert Reif
40009d091d
add multi-dimension array support to second checkScope and use it for member arrays
2011-09-11 20:42:57 -04:00
Robert Reif
0d6592dd2e
use correct checkScope function in CheckBufferOverrun for single dimension member arrays
2011-09-11 19:21:13 -04:00
Robert Reif
19928e26d1
refactor to unify functionally identical code in CheckBufferOverrun::checkScope()
2011-09-11 14:00:53 -04:00
Robert Reif
547a79d4fe
calculate array size for variable length structures with array at end in CheckBufferOverrun::checkStructVariable() when possible
2011-09-10 10:14:32 -04:00
Robert Reif
b0eab2587d
better detection of variable sized structure in CheckBufferOverrun::checkStructVariable()
2011-09-09 08:37:24 -04:00
Robert Reif
27bfa2a346
fix some CheckBufferOverrun::checkStructVariable() flase negatives for possible variable length structs
2011-09-09 07:46:06 -04:00
Robert Reif
16924c7c7a
fix #3094 (Buffer access out-of-bounds in struct variable)
2011-09-09 07:16:39 -04:00
Robert Reif
812a17f294
fix one of the TODO testcases added for #3094 (Buffer access out-of-bounds in struct variable)
2011-09-08 22:44:25 -04:00
Robert Reif
65b1a4df19
add soem test cases for #3094 (Buffer access out-of-bounds in struct variable)
2011-09-08 22:41:18 -04:00
Robert Reif
7451c5cece
warn when buffer is not zero terminated after memmove
2011-09-05 15:59:41 -04:00
Robert Reif
f5d71d1ac5
warn when buffer is not zero terminated after memcpy
2011-09-05 15:41:37 -04:00
Robert Reif
3c8988e7a5
warn when buffer is not zero terminated after strncpy
2011-09-05 15:19:38 -04:00
Robert Reif
fe85b8779e
fix #2528 (false negative: buffer access out of bounds)
2011-09-04 21:39:52 -04:00
Robert Reif
50688b28fd
fix #2889 (false negative: buffer access out of bounds on local struct member)
2011-09-04 19:54:57 -04:00
Robert Reif
c2b76cd41f
add some variable length array tests
2011-09-04 14:39:24 -04:00
Robert Reif
e782d98241
final fix for #3063 (false negative: multi dimensional arrays not well supported)
2011-09-03 21:51:00 -04:00
Daniel Marjamäki
d23c58d387
enable: break out 'performance' and 'portability' from the 'style' id. Ticket: #3074
2011-09-03 15:30:30 +02:00
Robert Reif
d749e28dc0
another partial fix for #3063 (false negative: multi dimensional arrays not well supported)
2011-09-02 21:07:29 -04:00
Robert Reif
d85410de8c
partial fix for #3063 (false negative: multi dimensional arrays not well supported)
2011-09-02 19:35:09 -04:00
Daniel Marjamäki
ef30da51bf
Fixed #3034 (Cppcheck crash on specific file (truecrypt).)
2011-08-29 19:16:52 +02:00
Robert Reif
cf6d04de74
fix #3044 (Symbol database: handle multidim array with unknown dimension 'char a[][4]')
2011-08-28 11:40:55 -04:00
Robert Reif
d643397a7e
better message for strncpy zero-terminated check
2011-08-28 09:06:51 -04:00
Robert Reif
8c093d0f8a
refactor CheckBufferOverrun::checkScope strncpy check and change experimental to inconclusive
2011-08-27 21:18:39 -04:00
Robert Reif
c4fdb8d113
better test for symbol database bug fixed in last commit
2011-08-24 06:53:27 -04:00
Robert Reif
8c1efe9bb6
improve message for #3035 (false negative: strcpy(dst, src) where src is bigger than dst)
2011-08-21 15:18:41 -04:00
Robert Reif
67e8731a96
partial fix for #3035 (false negative: strcpy(dst, src) where src is bigger than dst)
2011-08-21 14:44:55 -04:00
Robert Reif
a30da73d3e
fix #2986 (segmentation fault of cppcheck ( x[y] ))
2011-08-09 19:45:18 -04:00
Daniel Marjamäki
e2367b4149
Fixed #2976 (False positive: array out of bounds)
2011-08-08 18:22:15 +02:00
Daniel Marjamäki
999b80bbb8
Buffer overrun: Fix false negative
2011-08-07 17:54:25 +02:00
Kimmo Varis
cfcfa3f000
Use "enabled" list for the style checking.
...
Settings-class currently enables style checking via dedicated
boolean attribute. All other CLI's enable-options are handled
through the enable-list. This commit moves style-check enabling
to use the enable-list.
Main advantage is the consistency how options are handled/stored
in the Settings class. Which also unifies using them for the other
code. You need to enable certain type of checks? Use the
addEnabled()-method. You want to check if certain type of checks
are enabled? Use the isEnabled()-method.
2011-08-07 10:28:52 +03:00
Daniel Marjamäki
fd7e085c9d
Array index out of bounds: prevent false positive when a dimension for an array is unknown
2011-08-05 13:08:48 +02:00
Daniel Marjamäki
0186fc0650
tweaked the error message somewhat for id arrayIndexThenCheck
2011-08-05 09:10:07 +02:00
Daniel Marjamäki
ceb763f57a
Fixed #2956 (False negative: read array and then immediately check the index 'str[i] && i<sizeof(str)')
2011-08-04 11:15:14 +02:00
Daniel Marjamäki
3cfef6285c
Fixed #2920 (False positive: Array 'arr[0]' index 0 out of bounds (array size and index are unknown))
2011-07-20 07:57:42 +02:00
Daniel Marjamäki
7dcb68f5a4
CheckBufferOverrun: Detect overflows when buffer is allocated with alloca
2011-07-17 09:35:51 +02:00
Daniel Marjamäki
e597ad72e7
Fixed #2841 (False positive: Array index out of bounds, can't compare ints to chars)
2011-06-29 18:44:05 +02:00
Daniel Marjamäki
af7c97f972
Fixed #1684 (false positive: buffer access out of bounds when using extern variable declaration)
2011-05-07 11:34:48 +02:00
Daniel Marjamäki
e5d43d4ed2
Renamed Settings::stupid to Settings::experimental
2011-04-10 15:55:08 +02:00
Daniel Marjamäki
30ee9ba6e4
Added Settings::stupid flag that can be used to hide checking that generates false positives.
2011-04-10 13:23:45 +02:00
Daniel Marjamäki
07fe361964
Fixed #2638 (Tokenizer::setVarId : varid is wrongly given when unknown macro is used)
2011-03-13 17:52:45 +01:00
Daniel Marjamäki
bea3875386
Fixed #2607 (segmentation fault of cppcheck ( struct C {} {} x))
2011-03-09 21:00:28 +01:00
Daniel Marjamäki
bf2362d558
Fixed #2634 (False positive: buffer access out of bounds)
2011-03-08 19:49:56 +01:00
Reijo Tomperi
7f9dc42ff1
Fix test array_index_24() to share code with environments where plain char is either signed or unsigned.
...
This was done, because that particular test has been already fixed a couple of times and it is still broken in some systems.
2011-02-22 21:46:12 +02:00
Daniel Marjamäki
bfe28d3b26
Fixed #2597 (False positive: Buffer access out-of-bounds for u_char, uint*_t, ...)
2011-02-20 21:24:57 +01:00
Raphael Geissert
5998ec4af9
Really fix the build failure this time
2011-02-15 14:10:56 -06:00
Daniel Marjamäki
aacb94c427
Revert "Buffer overruns: Removed TODO test case. We intentionally don't check struct/class arrays fully to avoid false positives"
...
This reverts commit 87cc42e6f0
.
2011-02-13 22:48:26 +01:00
Daniel Marjamäki
87cf0949f2
Buffer overruns: Removed TODO test case. We intentionally don't check struct/class arrays fully to avoid false positives
2011-02-13 21:48:13 +01:00
Daniel Marjamäki
87cc42e6f0
Buffer overruns: Removed TODO test case. We intentionally don't check struct/class arrays fully to avoid false positives
2011-02-13 21:42:35 +01:00
Daniel Marjamäki
518a495334
Fixed #2576 (False positive: (error) Buffer access out-of-bounds)
2011-02-12 18:34:12 +01:00
Daniel Marjamäki
318f2e8a57
Fixed #2561 (False positive on array index when using conditional operator)
2011-02-12 11:31:10 +01:00
Raphael Geissert
d8119cd57a
Fix test for architectures where char is unsigned
2011-02-12 02:42:31 -06:00
Erik Lax
c7821675dd
Preprocessor: Test handling of strings with multiple spaces (Ticket: #2548 )
2011-02-11 18:57:58 +01:00
Daniel Marjamäki
757c840633
astyle formatting
2011-01-31 17:26:07 +01:00
Ettl Martin
f3111b541e
#2528 added todo-testcase
2011-01-31 13:46:51 +01:00
Pete Johns
098f0bf3e6
Fixed #2526 (Make TODO_ASSERT_EQUALS take three arguments (value, to_be, as_is)?...
...
Removed replaced EXPECTED with...
WANTED (to-be): The future expected value.
CURRENT (as-is): Documenting how cppcheck behaves now.
This removes the need for an ASSERT_EQUALS but enforces the check for every TODO_ASSERT_EQUALS.
2011-01-30 23:20:11 +11:00
Daniel Marjamäki
9d3b242cd8
Fixed #1952 (false negative: buffer acces out of bounds with memcpy)
2011-01-22 21:31:26 +01:00
Reijo Tomperi
226b605774
Change year 2010 -> 2011 in license texts.
2011-01-09 21:33:36 +02:00
Daniel Marjamäki
79ef02812d
Fixed #2211 (false negative: buffer access out of bounds for(int i=0; i !=6;i++))
2011-01-09 18:51:28 +01:00
Kimmo Varis
b750a52f6d
Improve strncat 3rd parameter usage warning message.
...
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2011-01-04 23:17:44 +02:00
Daniel Marjamäki
4ec9d418ff
Fixed #2215 (Improve check: Writing outside malloc bounds not detected)
2011-01-01 20:56:21 +01:00
Daniel Marjamäki
2da3fea1b8
Fixed #2386 (segmentation fault occurs in the checking when typedef has same name as an enum constant)
2010-12-31 20:55:28 +01:00
Daniel Marjamäki
04eb9cf305
Fixed #2378 (Refactoring: create utility function that skips redundant if/for/while)
2010-12-31 18:07:46 +01:00
Daniel Marjamäki
ed6c76ce04
Fixed #2385 (False positive: array index out of bounds)
2010-12-31 17:43:38 +01:00
Daniel Marjamäki
38e7209d26
Fixed #2373 (Using XML2 in --errorlist output)
2010-12-29 12:43:29 +01:00
Daniel Marjamäki
bdf0cb7115
Fixed #2370 (false negative: Buffer access out-of-bounds (for with if, no break))
2010-12-28 20:46:31 +01:00
Daniel Marjamäki
6aa400fd80
Buffer overrun: UB when pointer arithmetic result points out of bounds. Ticket #1774
2010-12-26 21:23:28 +01:00
Daniel Marjamäki
8247270f35
Fixed #2328 (false positive: buffer overrun (for loop with a break => the end value is not reached))
2010-12-19 10:39:43 +01:00
Daniel Marjamäki
f6c00fc478
Fixed #2323 (false positive: Buffer access out of bounds)
2010-12-18 10:54:36 +01:00
Daniel Marjamäki
eb0231b48f
astyle formatting
2010-12-16 20:15:22 +01:00
Daniel Marjamäki
5ce63a1df0
Fixed #2292 (segmentation fault with cppcheck 1.46 with --errorlist)
2010-12-13 18:17:33 +01:00
Robert Reif
f12c0c7ada
Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219
2010-12-01 18:00:55 +01:00
Daniel Marjamäki
ec6edaee6e
Buffer overflow: Added unit test that makes sure that array index out of bounds is detected inside loop. Ticket: #2199
2010-11-21 12:24:57 +01:00
Daniel Marjamäki
66c2825b23
Fixed #2210 (False positive: buffer overrun (snprintf, unknown type))
2010-11-18 19:26:46 +01:00
Daniel Marjamäki
586f4992d8
Tokenizer::simplifyKnownVariables: Fixed TODO test cases in TestBufferOverrun
2010-11-07 17:42:32 +01:00
Daniel Marjamäki
fb068a4e71
Fixed #2170 (false positive: After a strncpy() the buffer should be zero-terminated)
2010-11-07 09:37:45 +01:00
Daniel Marjamäki
dd41c74d7f
Fixed #2136 (false negative: array bounds)
2010-11-06 09:10:10 +01:00
Daniel Marjamäki
52faadda89
Tokenizer: simplify calculations with zero better
2010-11-05 20:35:31 +01:00
Daniel Marjamäki
b55f6458a2
Fixed #2120 (False positive: array index out of bounds (unknown type in struct, sub function))
2010-10-30 12:32:43 +02:00
Daniel Marjamäki
79583ee45d
#2133 (cppcheck: floating point exception)
2010-10-26 20:05:34 +02:00
Daniel Marjamäki
306587b1d0
Buffer overruns: Fixed TODO test case
2010-10-24 11:32:27 +02:00
Daniel Marjamäki
f3c6c64e9a
Fixed #2121 (False positive: Buffer access out-of-bounds when using uint32_t)
2010-10-23 13:12:17 +02:00
Daniel Marjamäki
5deb046ac5
Fixed #2120 (False positive: array index out of bounds (unknown type in struct, sub function))
2010-10-23 08:49:03 +02:00
Daniel Marjamäki
9fdc03fc1d
Fixed #2117 (false positive: buffer access out of bounds)
2010-10-22 20:15:51 +02:00
Daniel Marjamäki
2ca7dbc004
Fixed #2109 (false positive: buffer overrun)
2010-10-19 18:23:44 +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
Daniel Marjamäki
ba2b986ece
Fixed #2097 (false positive: buffer access out of bounds)
2010-10-14 20:00:32 +02:00
Daniel Marjamäki
b6c995ea47
Fixed #2096 (False positive: buffer overrun (extern array))
2010-10-13 20:57:59 +02:00
Daniel Marjamäki
229604b3e3
Fixed #2093 (False positive: buffer access out of bounds (unknown type))
2010-10-13 18:06:50 +02:00
Daniel Marjamäki
9e15c4ef38
Fixed #2088 ([test.c:12]: (error) Buffer access out-of-bounds: l)
2010-10-12 19:35:20 +02:00
Daniel Marjamäki
74bf1821e6
Array index: detect array index out of bounds when datatype is unknown. Ticket: #2086
2010-10-11 20:52:14 +02:00
Daniel Marjamäki
a73ada54d5
Fixed #1705 (false negative: access past end of buffer)
2010-10-10 09:15:18 +02:00
Daniel Marjamäki
e7f7c77eab
Fixed #1948 (C++ class scoping not followed)
2010-08-24 22:04:14 +02:00
Erik Lax
248bb3b6e8
Fixed #1935 (false negative: detect buffer overrun from network functions (recv, recvfrom..))
2010-08-14 20:19:23 +02:00
Daniel Marjamäki
1b2f16f443
Buffer overflow: Fixed two TODO test cases
2010-08-05 11:01:47 +02:00
Daniel Marjamäki
33bf8bf730
Fixed #1670 (False negative: Array index out of bounds in return statement)
2010-08-04 20:38:52 +02:00
Daniel Marjamäki
bea714445a
Fixed #1850 (An access to a nested std::map via a negative integer key is reported as 'Array index out of bounds')
2010-07-14 12:24:07 +02:00
Daniel Marjamäki
b02fc037ed
Buffer Overrun: Fixed false positive when variable is reassigned in called function
2010-07-05 22:19:27 +02:00
Robert Reif
18bb7488b9
Fixed #1787 (false negative: out of bounds in derived class)
2010-06-13 07:17:50 +02:00
Martin Ettl
0d34416bce
added TODO_TESTCASE for ticket 1734: Array index out of bounds
2010-06-06 16:20:50 +02:00
Daniel Marjamäki
5789eb116d
astyle formatting
2010-06-02 18:09:25 +02:00
Zachary Blair
33b4254d33
Fixed #568 (string functions with command line arguments may overflow buffer)
2010-06-01 22:41:07 -07:00
Daniel Marjamäki
7601089bee
astyle formatting
2010-05-29 11:19:56 +02:00
Zachary Blair
59086fa599
Fixed #818 (Detect sprintf buffer overrun with struct members)
2010-05-28 22:51:28 -07:00
Daniel Marjamäki
d23f63c805
astyle formatting
2010-05-26 19:21:34 +02:00
Zachary Blair
619cfbc56f
Fixed #168 (buffer overflow: not enough room for the null terminator)
2010-05-26 01:56:34 -07:00
Daniel Marjamäki
c31accc52a
Fixed #1695 (Ticket #1614 is broken using latest from git)
2010-05-19 19:23:09 +02:00
Daniel Marjamäki
f8442391af
astyle formatting
2010-05-17 19:51:35 +02:00
Monika Lukow
71e5c56bf9
Fixed #1418 (false negative: buffer access out of bounds)
2010-05-16 23:53:42 +02:00
Daniel Marjamäki
01034cd48d
Refactoring: Removed 'possible error' message about cin
2010-05-16 19:09:36 +02:00
Daniel Marjamäki
26fab24de4
Refactoring: Removed some inconclusive checking in CheckBufferOverrun
2010-05-16 15:30:39 +02:00
Daniel Marjamäki
0415560912
refactoring: changed the severity for strncatUsage from possibleError to style
2010-05-02 09:54:08 +02:00
Daniel Marjamäki
883d462553
refactoring: Use style severity instead of possible error for the 'The size argument is given as a char constant'
2010-05-02 09:16:45 +02:00
Daniel Marjamäki
0444ff5298
Fixed #1627 (###### If you see this, there is a bug ###### - Token::Match('%varid% [ %num% ]', 0))
2010-04-26 18:52:40 +02:00
Daniel Marjamäki
1a34e7daf6
Fixed #948 (array index out of bound not detected 'a[i-1] = 0')
2010-04-25 07:34:50 +02:00
Daniel Marjamäki
8ccd95a643
Fixed #836 (buffer overrun: memmove)
2010-04-24 21:48:58 +02:00
Martin Ettl
5eb9c78533
added further testcases to multidimensional out of bounds unit test
2010-04-23 22:04:49 +02:00
Martin Ettl
bd4bead561
update in todo testcase (line number was wrong)
2010-04-23 21:59:46 +02:00
Martin Ettl
572ae0c1b4
added todo testcases for multidimensional out of bounds checking
2010-04-23 21:56:35 +02:00
Daniel Marjamäki
a3b781a181
Fixed #819 (array index out of bounds not detected for multidimension arrays)
2010-04-23 16:26:40 +02:00
Daniel Marjamäki
b9d8f52cca
CheckBufferOverrun: Fixed false positives caused by refactorings
2010-04-22 19:22:23 +02:00
Daniel Marjamäki
f9f6927e63
CheckBufferOverrun: Don't give false positives when reading from array with strncpy/strncat
2010-04-21 20:02:58 +02:00
Daniel Marjamäki
f057e127a0
CheckBufferOverrun: Refactoring the checking of function calls
2010-04-21 19:27:28 +02:00
Daniel Marjamäki
798aa84151
Refactoring: CheckBufferOverrun refactorings. split up the checkScope into two separate functions. The ArrayInfo usage was improved. Also broke out for-loop handling into separate functions.
2010-04-21 18:33:21 +02:00
Reijo Tomperi
96d66af478
Change "Array index -1 corresponds with 4294967295..." error message into "Array index -1 is out of bounds"
2010-04-20 21:44:31 +03:00
Daniel Marjamäki
7e2f39290d
Fixed #1614 (negative array index issues in latest from git)
2010-04-20 16:43:51 +02:00
Daniel Marjamäki
8eff4fcbba
Buffer overruns: Added testcase for negative index when using 2-dimensional array
2010-04-18 21:07:21 +02:00
Daniel Marjamäki
b6ab419a06
Buffer Overrun: Broke out the checking for negative array index
2010-04-18 20:51:39 +02:00
Daniel Marjamäki
a473345f18
Buffer overruns: First change to detect overruns in multidimensional arrays ( #819 )
2010-04-18 11:08:29 +02:00
Daniel Marjamäki
6db4ab68ef
Unit Testing: added assertions for todo testcases to detect changes
2010-04-17 15:01:18 +02:00
Daniel Marjamäki
c0e9a546f7
Refactoring: Refactoring the Settings class
2010-04-17 09:23:54 +02:00
Reijo Tomperi
35d2a27b9c
Update copyright year in all source files
2010-04-13 22:23:17 +03:00
Reijo Tomperi
d102369196
Fix #1590 (False negative: Array index out of bounds: "0 <= i")
...
http://sourceforge.net/apps/trac/cppcheck/ticket/1590
2010-04-12 22:04:59 +03:00
Reijo Tomperi
7f7e621ecb
More tests added to test/testbufferoverrun.cpp
2010-04-11 23:22:16 +03:00
Daniel Marjamäki
6f74c0af5e
Fixed #1587 (Crash while processing file)
2010-04-11 20:57:30 +02:00
Daniel Marjamäki
5fed938f56
Fixed #1190 (array index out of bounds when index variable is assigned in a condition)
2010-04-10 21:12:00 +02:00
Daniel Marjamäki
e17cce6ac4
Unit Testing: Added an ASSERT
2010-04-10 18:54:12 +02:00
Daniel Marjamäki
15da4fe689
Refactoring: simplified test case
2010-04-10 18:50:28 +02:00
Daniel Marjamäki
e9b4ea44a2
Refactoring: Disable inconclusive checks. They can still be activated for debugging/testing purposes
2010-04-10 14:05:33 +02:00
Daniel Marjamäki
b4e9185177
Fixed #1134 (improve check: pointer access out of bounds not detected (allocated with malloc))
2010-04-10 07:57:29 +02:00