mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Merge pull request #12959 from MathiasVP/identity-consistency-check
DataFlow: Add an "identity-step" consistency check
This commit is contained in:
@@ -58,6 +58,9 @@ module Consistency {
|
||||
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
|
||||
none()
|
||||
}
|
||||
|
||||
/** Holds if `n` should be excluded from the consistency test `identityLocalStep`. */
|
||||
predicate identityLocalStepExclude(Node n) { none() }
|
||||
}
|
||||
|
||||
private class RelevantNode extends Node {
|
||||
@@ -287,4 +290,10 @@ module Consistency {
|
||||
not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and
|
||||
msg = "Non-unique content approximation."
|
||||
}
|
||||
|
||||
query predicate identityLocalStep(Node n, string msg) {
|
||||
simpleLocalFlowStep(n, n) and
|
||||
not any(ConsistencyConfiguration c).identityLocalStepExclude(n) and
|
||||
msg = "Node steps to itself"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
identityLocalStep
|
||||
| calls/calls.rb:202:7:202:9 | SSA phi read(y) | Node steps to itself |
|
||||
| calls/calls.rb:205:7:205:7 | SSA phi read(self) | Node steps to itself |
|
||||
| calls/calls.rb:205:7:205:7 | SSA phi read(y) | Node steps to itself |
|
||||
| calls/calls.rb:210:11:210:13 | SSA phi read(y) | Node steps to itself |
|
||||
| calls/calls.rb:211:14:211:14 | SSA phi read(self) | Node steps to itself |
|
||||
| calls/calls.rb:211:14:211:14 | SSA phi read(y) | Node steps to itself |
|
||||
| calls/calls.rb:214:7:214:9 | SSA phi read(y) | Node steps to itself |
|
||||
| calls/calls.rb:217:7:217:7 | SSA phi read(self) | Node steps to itself |
|
||||
| calls/calls.rb:217:7:217:7 | SSA phi read(y) | Node steps to itself |
|
||||
| calls/calls.rb:222:11:222:13 | SSA phi read(y) | Node steps to itself |
|
||||
| calls/calls.rb:223:14:223:14 | SSA phi read(self) | Node steps to itself |
|
||||
| calls/calls.rb:223:14:223:14 | SSA phi read(y) | Node steps to itself |
|
||||
@@ -0,0 +1,13 @@
|
||||
identityLocalStep
|
||||
| calls.rb:202:7:202:9 | SSA phi read(y) | Node steps to itself |
|
||||
| calls.rb:205:7:205:7 | SSA phi read(self) | Node steps to itself |
|
||||
| calls.rb:205:7:205:7 | SSA phi read(y) | Node steps to itself |
|
||||
| calls.rb:210:11:210:13 | SSA phi read(y) | Node steps to itself |
|
||||
| calls.rb:211:14:211:14 | SSA phi read(self) | Node steps to itself |
|
||||
| calls.rb:211:14:211:14 | SSA phi read(y) | Node steps to itself |
|
||||
| calls.rb:214:7:214:9 | SSA phi read(y) | Node steps to itself |
|
||||
| calls.rb:217:7:217:7 | SSA phi read(self) | Node steps to itself |
|
||||
| calls.rb:217:7:217:7 | SSA phi read(y) | Node steps to itself |
|
||||
| calls.rb:222:11:222:13 | SSA phi read(y) | Node steps to itself |
|
||||
| calls.rb:223:14:223:14 | SSA phi read(self) | Node steps to itself |
|
||||
| calls.rb:223:14:223:14 | SSA phi read(y) | Node steps to itself |
|
||||
Reference in New Issue
Block a user