Skip to content

Commit 26a16b7

Browse files
Sim4n6yoff
authored andcommitted
use of a single var "op" of type Cmpop
1 parent a717bf1 commit 26a16b7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

python/ql/src/experimental/Security/CWE-770/UnicodeDoS.ql

+9-9
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,28 @@ class UnicodeCompatibilityNormalize extends API::CallNode {
4848

4949
predicate underAValue(DataFlow::GuardNode g, ControlFlowNode node, boolean branch) {
5050
exists(CompareNode cn | cn = g |
51-
exists(API::CallNode lenCall, Cmpop op_gt, Cmpop op_lt, Node n |
51+
exists(API::CallNode lenCall, Cmpop op, Node n |
5252
lenCall = n.getALocalSource() and
5353
(
5454
// arg <= LIMIT OR arg < LIMIT
55-
(op_lt = any(LtE lte) or op_lt = any(Lt lt)) and
55+
(op instanceof LtE or op instanceof Lt) and
5656
branch = true and
57-
cn.operands(n.asCfgNode(), op_lt, _)
57+
cn.operands(n.asCfgNode(), op, _)
5858
or
5959
// LIMIT >= arg OR LIMIT > arg
60-
(op_gt = any(GtE gte) or op_gt = any(Gt gt)) and
60+
(op instanceof GtE or op instanceof Gt) and
6161
branch = true and
62-
cn.operands(_, op_gt, n.asCfgNode())
62+
cn.operands(_, op, n.asCfgNode())
6363
or
6464
// not arg >= LIMIT OR not arg > LIMIT
65-
(op_gt = any(GtE gte) or op_gt = any(Gt gt)) and
65+
(op instanceof GtE or op instanceof Gt) and
6666
branch = false and
67-
cn.operands(n.asCfgNode(), op_gt, _)
67+
cn.operands(n.asCfgNode(), op, _)
6868
or
6969
// not LIMIT <= arg OR not LIMIT < arg
70-
(op_lt = any(LtE lte) or op_lt = any(Lt lt)) and
70+
(op instanceof LtE or op instanceof Lt) and
7171
branch = false and
72-
cn.operands(_, op_lt, n.asCfgNode())
72+
cn.operands(_, op, n.asCfgNode())
7373
)
7474
|
7575
lenCall = API::builtin("len").getACall() and

0 commit comments

Comments
 (0)