Skip to content

Commit 5deb16e

Browse files
committed
Ruby: Remove redundant predicate
The existing barrier guard machinery recognises guards such as `if x and y`, so there's no need to explicitly model them.
1 parent f24fa40 commit 5deb16e

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

ruby/ql/lib/codeql/ruby/dataflow/BarrierGuards.qll

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ private predicate stringConstCompare(CfgNodes::AstCfgNode guard, CfgNode testedN
3535
stringConstCompareOr(guard, def, branch) and
3636
stringConstCompare(g.getLeftOperand(), testedNode, _)
3737
)
38-
or
39-
stringConstCompareAnd(guard, testedNode, branch)
4038
}
4139

4240
/**
@@ -57,23 +55,6 @@ private predicate stringConstCompareOr(
5755
)
5856
}
5957

60-
/**
61-
* Holds if `guard` is an `and` expression containing a string comparison guard in either operand.
62-
* For example:
63-
*
64-
* ```rb
65-
* x == "foo" and other_condition()
66-
* other_condition() and x == "foo"
67-
* ```
68-
*/
69-
private predicate stringConstCompareAnd(
70-
CfgNodes::ExprNodes::BinaryOperationCfgNode guard, CfgNode testedNode, boolean branch
71-
) {
72-
guard.getExpr() instanceof LogicalAndExpr and
73-
branch = true and
74-
stringConstCompare(guard.getAnOperand(), testedNode, branch)
75-
}
76-
7758
/**
7859
* A validation of value by comparing with a constant string value, for example
7960
* in:

0 commit comments

Comments
 (0)