You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cxx-sensors/src/main/resources/cppcheck.xml
+28-39Lines changed: 28 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -319,22 +319,15 @@ Buffer overrun possible for long command line arguments.
319
319
</rule>
320
320
<rule>
321
321
<key>pointerOutOfBounds</key>
322
-
<name>Undefined behaviour, pointer arithmetic 'expr' or index is out of bounds</name>
322
+
<name>Pointer arithmetic overflow</name>
323
323
<description>
324
324
<![CDATA[
325
325
<p>
326
-
Undefined behaviour, pointer arithmetic '' is out of bounds. From
327
-
chapter 6.5.6 in the C specification:
328
-
<cite>"When an expression that has
329
-
integer type is added to or subtracted from a pointer, .."</cite> and then
330
-
<cite>"If both the pointer operand and the result point to elements of the
331
-
same array object, or one past the last element of the array object,
332
-
the evaluation shall not produce an overflow; otherwise, the behavior
333
-
is undefined."</cite>
326
+
Pointer arithmetic overflow.
334
327
</p>
335
328
<h2>References</h2>
336
-
<p><a href="https://cwe.mitre.org/data/definitions/398.html" target="_blank">CWE-398: Indicator of Poor Code Quality</a></p>
337
-
]]>
329
+
<p><a href="https://cwe.mitre.org/data/definitions/758.html" target="_blank">CWE-758: Reliance on Undefined, Unspecified, or Implementation-Defined Behavior</a></p>
330
+
]]>
338
331
</description>
339
332
<tag>cwe</tag>
340
333
<tag>bug</tag>
@@ -2135,7 +2128,7 @@ string literal.
2135
2128
<p>
2136
2129
Calling sizeof for 'sizeof looks like a suspicious code and most
2137
2130
likely there should be just one 'sizeof'. The current code is
<p><a href="https://cwe.mitre.org/data/definitions/398.html" target="_blank">CWE-398: Indicator of Poor Code Quality</a></p>
2370
2358
]]>
@@ -2717,15 +2705,15 @@ not properly checked.
2717
2705
</rule>
2718
2706
<rule>
2719
2707
<key>stlIfStrFind</key>
2720
-
<name>Inefficient usage of string::find() in condition; string::compare() would be faster</name>
2708
+
<name>Inefficient usage of string::find() in condition; string::starts_with() would be faster</name>
2721
2709
<description>
2722
2710
<![CDATA[
2723
2711
<p>
2724
-
Either inefficient or wrong usage of string::find(). string::compare()
2725
-
will be faster if string::find's result is compared with 0, because it
2726
-
will not scan the whole string. If your intention is to check that
2727
-
there are no findings in the string, you should compare with
2728
-
std::string::npos.
2712
+
Either inefficient or wrong usage of string::find().
2713
+
string::starts_with() will be faster if string::find's result is
2714
+
compared with 0, because it will not scan the whole string. If your
2715
+
intention is to check that there are no findings in the string, you
2716
+
should compare with std::string::npos.
2729
2717
</p>
2730
2718
<h2>References</h2>
2731
2719
<p><a href="https://cwe.mitre.org/data/definitions/597.html" target="_blank">CWE-597: Use of Wrong Operator in String Comparison</a></p>
@@ -3305,7 +3293,7 @@ invalid.
3305
3293
<![CDATA[
3306
3294
<p>
3307
3295
BOOST_FOREACH caches the end() iterator. It's undefined behavior if
3308
-
you modify the container inside.
3296
+
you modify the container inside.
3309
3297
</p>
3310
3298
<h2>References</h2>
3311
3299
<p><a href="https://cwe.mitre.org/data/definitions/664.html" target="_blank">CWE-664: Improper Control of a Resource Through its Lifetime</a></p>
@@ -4264,9 +4252,11 @@ meaningless. Did you intend to write '(*A)++;'?
4264
4252
</rule>
4265
4253
<rule>
4266
4254
<key>comparisonOfBoolWithInvalidComparator</key>
4267
-
<name>Comparison of a boolean value using relational (<, >, <= or >=) operator</name>
4255
+
<name>Comparison of a boolean value using relational operator (<, >, <= or >=)</name>
4268
4256
<description>
4269
-
Comparison of a boolean value using relational (<, >, <= or >=) operator.
4257
+
<![CDATA[
4258
+
The result of the expression 'expression' is of type 'bool'. Comparing 'bool' value using relational (<, >, <= or >=) operator could cause unexpected results.
The array 'buffer' is filled incompletely. The function 'function()'
4299
+
The array 'buffer' is filled incompletely. The function 'memset()'
4310
4300
needs the size given in bytes, but an element of the given array is
4311
4301
larger than one byte. Did you forget to multiply the size with
4312
4302
'sizeof(*buffer)'?
@@ -4651,7 +4641,7 @@ copy constructor instead of allocating new memory.
4651
4641
<name>Invalid memory address freed</name>
4652
4642
<description>
4653
4643
<![CDATA[
4654
-
Invalid memory address freed.
4644
+
Mismatching address is freed. The address you get from malloc() must be freed without offset.
4655
4645
]]>
4656
4646
</description>
4657
4647
<internalKey>invalidFree</internalKey>
@@ -5695,12 +5685,11 @@ no effect.
5695
5685
<description>
5696
5686
<![CDATA[
5697
5687
<p>
5698
-
Array 'x[SZ]' accessed at larger index I, which is out of bounds. Otherwise
5699
-
condition '==I' is redundant.
5688
+
Array 'x[SZ]' accessed at larger index I, which is out of bounds.
5700
5689
</p>
5701
5690
<h2>References</h2>
5702
-
<p><a href="https://cwe.mitre.org/data/definitions/119.html" target="_blank">CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer</a></p>
5703
-
]]>
5691
+
<p><a href="https://cwe.mitre.org/data/definitions/788.html" target="_blank">CWE-788: Access of Memory Location After End of Buffer</a></p>
5692
+
]]>
5704
5693
</description>
5705
5694
<tag>bug</tag>
5706
5695
<tag>cert</tag>
@@ -6632,8 +6621,8 @@ Unsafe allocation. If funcName() throws, memory could be leaked. Use
<p><a href="https://cwe.mitre.org/data/definitions/401.html" target="_blank">CWE-401: Improper Release of Memory Before Removing Last Reference ('Memory Leak')</a></p>
6636
-
]]>
6624
+
<p><a href="https://cwe.mitre.org/data/definitions/401.html" target="_blank">CWE-401: Improper Release of Memory Before Removing Last Reference</a></p>
0 commit comments