Skip to content

Commit 2a552d9

Browse files
committed
Swift: Address QL-for-QL warning.
1 parent 2cfca03 commit 2a552d9

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

swift/ql/lib/codeql/swift/regex/Regex.qll

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -488,19 +488,24 @@ module NSStringCompareOptionsFlagFlow = DataFlow::Global<NSStringCompareOptionsF
488488
* A call to a function that evaluates a regular expression because
489489
* `NSString.CompareOptions.regularExpression` is set as an `options` argument.
490490
*/
491-
private class NSStringCompareOptionsRegexEval extends RegexEval {
492-
NSStringCompareOptionsPotentialRegexEval potentialEval;
493-
491+
private class NSStringCompareOptionsRegexEval extends RegexEval instanceof NSStringCompareOptionsPotentialRegexEval
492+
{
494493
NSStringCompareOptionsRegexEval() {
495-
this = potentialEval and
496494
// check there is flow from a `NSString.CompareOptions.regularExpression` value to an `options` argument;
497495
// if there isn't, the input won't be interpretted as a regular expression.
498-
NSStringCompareOptionsFlagFlow::flow(_, potentialEval.getAnOptionsInput())
496+
NSStringCompareOptionsFlagFlow::flow(_,
497+
this.(NSStringCompareOptionsPotentialRegexEval).getAnOptionsInput())
499498
}
500499

501-
override DataFlow::Node getRegexInputNode() { result = potentialEval.getRegexInput() }
500+
override DataFlow::Node getRegexInputNode() {
501+
result = this.(NSStringCompareOptionsPotentialRegexEval).getRegexInput()
502+
}
502503

503-
override DataFlow::Node getStringInputNode() { result = potentialEval.getStringInput() }
504+
override DataFlow::Node getStringInputNode() {
505+
result = this.(NSStringCompareOptionsPotentialRegexEval).getStringInput()
506+
}
504507

505-
override DataFlow::Node getAnOptionsInput() { result = potentialEval.getAnOptionsInput() }
508+
override DataFlow::Node getAnOptionsInput() {
509+
result = this.(NSStringCompareOptionsPotentialRegexEval).getAnOptionsInput()
510+
}
506511
}

0 commit comments

Comments
 (0)