Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 73cbdee commit 09ca665Copy full SHA for 09ca665
2 files changed
javascript/ql/src/semmle/javascript/RangeAnalysis.qll
@@ -163,6 +163,12 @@ module RangeAnalysis {
163
else
164
bias = -1)
165
or
166
+ exists (UpdateExpr update | r.asExpr() = update | // Return value of x++ is just x (coerced to an int)
167
+ root = update.getOperand().flow() and
168
+ not update.isPrefix() and
169
+ sign = 1 and
170
+ bias = 0)
171
+ or
172
exists (CompoundAssignExpr assign | r = compoundAssignResult(assign) |
173
root = assign.getLhs().flow() and
174
sign = 1 and
javascript/ql/test/library-tests/RangeAnalysis/plus.js
@@ -26,3 +26,8 @@ function g(x) {
26
if (z < x + 5) {} // NOT OK - always true
27
if (z > x + 5) {} // NOT OK - always false
28
}
29
+
30
+function h(x) {
31
+ let y = x++;
32
+ if (x > y) {} // NOT OK - always true
33
+}
0 commit comments