Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc7ea93

Browse files
committed
Java: Adjust some comment positions and break some lines.
1 parent 5502db4 commit bc7ea93

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

java/ql/src/semmle/code/java/dataflow/IntegerGuards.qll

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,18 @@ Expr integerGuard(IntComparableExpr e, boolean branch, int k, boolean is_k) {
7676
bounded(c, any(ZeroBound zb), val, upper, _) and
7777
is_k = false
7878
|
79-
comp.getLesserOperand() = c and comp.isStrict() and branch = true and val >= k and upper = false // k <= val <= c < e, so e != k
79+
// k <= val <= c < e, so e != k
80+
comp.getLesserOperand() = c and
81+
comp.isStrict() and
82+
branch = true and
83+
val >= k and
84+
upper = false
8085
or
81-
comp.getLesserOperand() = c and comp.isStrict() and branch = false and val < k and upper = true
86+
comp.getLesserOperand() = c and
87+
comp.isStrict() and
88+
branch = false and
89+
val < k and
90+
upper = true
8291
or
8392
comp.getLesserOperand() = c and
8493
not comp.isStrict() and
@@ -92,7 +101,11 @@ Expr integerGuard(IntComparableExpr e, boolean branch, int k, boolean is_k) {
92101
val <= k and
93102
upper = true
94103
or
95-
comp.getGreaterOperand() = c and comp.isStrict() and branch = true and val <= k and upper = true
104+
comp.getGreaterOperand() = c and
105+
comp.isStrict() and
106+
branch = true and
107+
val <= k and
108+
upper = true
96109
or
97110
comp.getGreaterOperand() = c and
98111
comp.isStrict() and
@@ -128,24 +141,28 @@ Expr intBoundGuard(RValue x, boolean branch_with_lower_bound_k, int k) {
128141
c.getIntValue() = val and
129142
x.getVariable().getType() instanceof IntegralType
130143
|
144+
// c < x
131145
comp.getLesserOperand().getProperExpr() = c and
132146
comp.isStrict() and
133147
branch_with_lower_bound_k = true and
134-
val + 1 = k // c < x
148+
val + 1 = k
135149
or
150+
// c <= x
136151
comp.getLesserOperand().getProperExpr() = c and
137152
not comp.isStrict() and
138153
branch_with_lower_bound_k = true and
139-
val = k // c <= x
154+
val = k
140155
or
156+
// x < c
141157
comp.getGreaterOperand().getProperExpr() = c and
142158
comp.isStrict() and
143159
branch_with_lower_bound_k = false and
144-
val = k // x < c
160+
val = k
145161
or
162+
// x <= c
146163
comp.getGreaterOperand().getProperExpr() = c and
147164
not comp.isStrict() and
148165
branch_with_lower_bound_k = false and
149-
val + 1 = k // x <= c
166+
val + 1 = k
150167
)
151168
}

0 commit comments

Comments
 (0)