File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
autosar/test/rules/A4-7-1
common/src/codingstandards/cpp Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change
1
+ * ` A4-7-1 ` - exclude pointer increment and decrement operators from this rule.
Original file line number Diff line number Diff line change @@ -62,4 +62,10 @@ void test_loop_bound_bad(unsigned int n) {
62
62
i++) { // NON_COMPLIANT - crement will overflow before loop bound is
63
63
// reached
64
64
}
65
+ }
66
+
67
+ void test_pointer () {
68
+ int *p = nullptr ;
69
+ p++; // COMPLIANT - not covered by this rule
70
+ p--; // COMPLIANT - not covered by this rule
65
71
}
Original file line number Diff line number Diff line change 1
1
/**
2
- * This module provides predicates for checking whether an operation overflows or wraps.
2
+ * This module provides predicates for checking whether an integer operation overflows, underflows or wraps.
3
3
*/
4
4
5
5
import cpp
@@ -10,10 +10,12 @@ import codingstandards.cpp.dataflow.TaintTracking
10
10
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
11
11
12
12
/**
13
- * An operation that may overflow or underflow .
13
+ * An integer operation that may overflow, underflow or wrap .
14
14
*/
15
15
class InterestingOverflowingOperation extends Operation {
16
16
InterestingOverflowingOperation ( ) {
17
+ // We are only interested in integer experssions
18
+ this .getUnderlyingType ( ) instanceof IntegralType and
17
19
// Might overflow or underflow
18
20
(
19
21
exprMightOverflowNegatively ( this )
You can’t perform that action at this time.
0 commit comments