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) {
6262 i++) { // NON_COMPLIANT - crement will overflow before loop bound is
6363 // reached
6464 }
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
6571}
Original file line number Diff line number Diff line change 11/**
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.
33 */
44
55import cpp
@@ -10,10 +10,12 @@ import codingstandards.cpp.dataflow.TaintTracking
1010import semmle.code.cpp.valuenumbering.GlobalValueNumbering
1111
1212/**
13- * An operation that may overflow or underflow .
13+ * An integer operation that may overflow, underflow or wrap .
1414 */
1515class InterestingOverflowingOperation extends Operation {
1616 InterestingOverflowingOperation ( ) {
17+ // We are only interested in integer experssions
18+ this .getUnderlyingType ( ) instanceof IntegralType and
1719 // Might overflow or underflow
1820 (
1921 exprMightOverflowNegatively ( this )
You can’t perform that action at this time.
0 commit comments