Skip to content

Commit 6cd6f74

Browse files
committed
Swift: Repair predicate lost in merge.
1 parent 72fd717 commit 6cd6f74

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

swift/ql/src/queries/Security/CWE-135/StringLengthConflation.ql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
179179
)
180180
}
181181

182+
override predicate isSink(DataFlow::Node node, string flowstate) {
183+
// Permit any *incorrect* flowstate, as those are the results the query
184+
// should report.
185+
exists(string correctFlowState |
186+
isSinkImpl(node, correctFlowState) and
187+
flowstate.(StringLengthConflationFlowState).getEquivClass() !=
188+
correctFlowState.(StringLengthConflationFlowState).getEquivClass()
189+
)
190+
}
191+
182192
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
183193
// allow flow through `+`, `-`, `*` etc.
184194
node2.asExpr().(ArithmeticOperation).getAnOperand() = node1.asExpr()

0 commit comments

Comments
 (0)