Skip to content

Commit b4724e4

Browse files
committed
[DIFF-INFORMED] C++: CWE-190/ArithmeticTainted,etc.
1 parent 6e2c11a commit b4724e4

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

cpp/ql/src/Security/CWE/CWE-190/ArithmeticTainted.ql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ module Config implements DataFlow::ConfigSig {
106106
not iTo instanceof PointerArithmeticInstruction
107107
)
108108
}
109+
110+
predicate observeDiffInformedIncrementalMode() { any() }
111+
112+
Location getASelectedSinkLocation(DataFlow::Node sink) {
113+
exists(Expr e | result = e.getLocation() | isSink(sink, _, e))
114+
}
109115
}
110116

111117
module Flow = TaintTracking::Global<Config>;

cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ module UncontrolledArithConfig implements DataFlow::ConfigSig {
120120
// block unintended flow to pointers
121121
node.asExpr().getUnspecifiedType() instanceof PointerType
122122
}
123+
124+
predicate observeDiffInformedIncrementalMode() { any() }
125+
126+
Location getASelectedSourceLocation(DataFlow::Node source) {
127+
result = getExpr(source).getLocation()
128+
}
123129
}
124130

125131
module UncontrolledArith = TaintTracking::Global<UncontrolledArithConfig>;

cpp/ql/src/Security/CWE/CWE-190/ArithmeticWithExtremeValues.ql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ module Config implements DataFlow::ConfigSig {
113113
not iTo instanceof PointerArithmeticInstruction
114114
)
115115
}
116+
117+
predicate observeDiffInformedIncrementalMode() { any() }
118+
119+
Location getASelectedSinkLocation(DataFlow::Node sink) {
120+
exists(VariableAccess va | result = va.getLocation() | isSink(sink, va, _))
121+
}
116122
}
117123

118124
module Flow = TaintTracking::Global<Config>;

cpp/ql/src/Security/CWE/CWE-190/TaintedAllocationSize.ql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ module TaintedAllocationSizeConfig implements DataFlow::ConfigSig {
9191
// to duplicate results)
9292
any(HeuristicAllocationFunction f).getAParameter() = node.asParameter()
9393
}
94+
95+
predicate observeDiffInformedIncrementalMode() { any() }
96+
97+
Location getASelectedSinkLocation(DataFlow::Node sink) {
98+
exists(Expr alloc | result = alloc.getLocation() | allocSink(alloc, sink))
99+
}
94100
}
95101

96102
module TaintedAllocationSize = TaintTracking::Global<TaintedAllocationSizeConfig>;

0 commit comments

Comments
 (0)