Skip to content

Commit e0ccb93

Browse files
authored
Merge pull request #11908 from RasmusWL/dataflow-consistency-more-excludes
DataFlow: Add `uniqueParameterNodePositionExclude`
2 parents 8910ba4 + a0b1c2e commit e0ccb93

File tree

8 files changed

+96
-0
lines changed

8 files changed

+96
-0
lines changed

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module Consistency {
4545
) {
4646
none()
4747
}
48+
49+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
50+
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
51+
none()
52+
}
53+
54+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
55+
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
56+
none()
57+
}
4858
}
4959

5060
private class RelevantNode extends Node {
@@ -246,6 +256,7 @@ module Consistency {
246256
query predicate uniqueParameterNodeAtPosition(
247257
DataFlowCallable c, ParameterPosition pos, Node p, string msg
248258
) {
259+
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
249260
isParameterNode(p, c, pos) and
250261
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
251262
msg = "Parameters with overlapping positions."
@@ -254,6 +265,7 @@ module Consistency {
254265
query predicate uniqueParameterNodePosition(
255266
DataFlowCallable c, ParameterPosition pos, Node p, string msg
256267
) {
268+
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
257269
isParameterNode(p, c, pos) and
258270
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
259271
msg = "Parameter node with multiple positions."

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module Consistency {
4545
) {
4646
none()
4747
}
48+
49+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
50+
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
51+
none()
52+
}
53+
54+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
55+
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
56+
none()
57+
}
4858
}
4959

5060
private class RelevantNode extends Node {
@@ -246,6 +256,7 @@ module Consistency {
246256
query predicate uniqueParameterNodeAtPosition(
247257
DataFlowCallable c, ParameterPosition pos, Node p, string msg
248258
) {
259+
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
249260
isParameterNode(p, c, pos) and
250261
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
251262
msg = "Parameters with overlapping positions."
@@ -254,6 +265,7 @@ module Consistency {
254265
query predicate uniqueParameterNodePosition(
255266
DataFlowCallable c, ParameterPosition pos, Node p, string msg
256267
) {
268+
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
257269
isParameterNode(p, c, pos) and
258270
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
259271
msg = "Parameter node with multiple positions."

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module Consistency {
4545
) {
4646
none()
4747
}
48+
49+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
50+
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
51+
none()
52+
}
53+
54+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
55+
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
56+
none()
57+
}
4858
}
4959

5060
private class RelevantNode extends Node {
@@ -246,6 +256,7 @@ module Consistency {
246256
query predicate uniqueParameterNodeAtPosition(
247257
DataFlowCallable c, ParameterPosition pos, Node p, string msg
248258
) {
259+
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
249260
isParameterNode(p, c, pos) and
250261
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
251262
msg = "Parameters with overlapping positions."
@@ -254,6 +265,7 @@ module Consistency {
254265
query predicate uniqueParameterNodePosition(
255266
DataFlowCallable c, ParameterPosition pos, Node p, string msg
256267
) {
268+
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
257269
isParameterNode(p, c, pos) and
258270
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
259271
msg = "Parameter node with multiple positions."

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module Consistency {
4545
) {
4646
none()
4747
}
48+
49+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
50+
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
51+
none()
52+
}
53+
54+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
55+
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
56+
none()
57+
}
4858
}
4959

5060
private class RelevantNode extends Node {
@@ -246,6 +256,7 @@ module Consistency {
246256
query predicate uniqueParameterNodeAtPosition(
247257
DataFlowCallable c, ParameterPosition pos, Node p, string msg
248258
) {
259+
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
249260
isParameterNode(p, c, pos) and
250261
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
251262
msg = "Parameters with overlapping positions."
@@ -254,6 +265,7 @@ module Consistency {
254265
query predicate uniqueParameterNodePosition(
255266
DataFlowCallable c, ParameterPosition pos, Node p, string msg
256267
) {
268+
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
257269
isParameterNode(p, c, pos) and
258270
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
259271
msg = "Parameter node with multiple positions."

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module Consistency {
4545
) {
4646
none()
4747
}
48+
49+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
50+
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
51+
none()
52+
}
53+
54+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
55+
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
56+
none()
57+
}
4858
}
4959

5060
private class RelevantNode extends Node {
@@ -246,6 +256,7 @@ module Consistency {
246256
query predicate uniqueParameterNodeAtPosition(
247257
DataFlowCallable c, ParameterPosition pos, Node p, string msg
248258
) {
259+
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
249260
isParameterNode(p, c, pos) and
250261
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
251262
msg = "Parameters with overlapping positions."
@@ -254,6 +265,7 @@ module Consistency {
254265
query predicate uniqueParameterNodePosition(
255266
DataFlowCallable c, ParameterPosition pos, Node p, string msg
256267
) {
268+
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
257269
isParameterNode(p, c, pos) and
258270
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
259271
msg = "Parameter node with multiple positions."

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module Consistency {
4545
) {
4646
none()
4747
}
48+
49+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
50+
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
51+
none()
52+
}
53+
54+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
55+
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
56+
none()
57+
}
4858
}
4959

5060
private class RelevantNode extends Node {
@@ -246,6 +256,7 @@ module Consistency {
246256
query predicate uniqueParameterNodeAtPosition(
247257
DataFlowCallable c, ParameterPosition pos, Node p, string msg
248258
) {
259+
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
249260
isParameterNode(p, c, pos) and
250261
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
251262
msg = "Parameters with overlapping positions."
@@ -254,6 +265,7 @@ module Consistency {
254265
query predicate uniqueParameterNodePosition(
255266
DataFlowCallable c, ParameterPosition pos, Node p, string msg
256267
) {
268+
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
257269
isParameterNode(p, c, pos) and
258270
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
259271
msg = "Parameter node with multiple positions."

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module Consistency {
4545
) {
4646
none()
4747
}
48+
49+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
50+
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
51+
none()
52+
}
53+
54+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
55+
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
56+
none()
57+
}
4858
}
4959

5060
private class RelevantNode extends Node {
@@ -246,6 +256,7 @@ module Consistency {
246256
query predicate uniqueParameterNodeAtPosition(
247257
DataFlowCallable c, ParameterPosition pos, Node p, string msg
248258
) {
259+
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
249260
isParameterNode(p, c, pos) and
250261
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
251262
msg = "Parameters with overlapping positions."
@@ -254,6 +265,7 @@ module Consistency {
254265
query predicate uniqueParameterNodePosition(
255266
DataFlowCallable c, ParameterPosition pos, Node p, string msg
256267
) {
268+
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
257269
isParameterNode(p, c, pos) and
258270
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
259271
msg = "Parameter node with multiple positions."

swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module Consistency {
4545
) {
4646
none()
4747
}
48+
49+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
50+
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
51+
none()
52+
}
53+
54+
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
55+
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
56+
none()
57+
}
4858
}
4959

5060
private class RelevantNode extends Node {
@@ -246,6 +256,7 @@ module Consistency {
246256
query predicate uniqueParameterNodeAtPosition(
247257
DataFlowCallable c, ParameterPosition pos, Node p, string msg
248258
) {
259+
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
249260
isParameterNode(p, c, pos) and
250261
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
251262
msg = "Parameters with overlapping positions."
@@ -254,6 +265,7 @@ module Consistency {
254265
query predicate uniqueParameterNodePosition(
255266
DataFlowCallable c, ParameterPosition pos, Node p, string msg
256267
) {
268+
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
257269
isParameterNode(p, c, pos) and
258270
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
259271
msg = "Parameter node with multiple positions."

0 commit comments

Comments
 (0)