mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Java: Join-order fix in RangeAnalysis.
This commit is contained in:
@@ -257,11 +257,21 @@ private Guard boundFlowCond(SsaVariable v, Expr e, int delta, boolean upper, boo
|
||||
or
|
||||
// guard that tests whether `v2` is bounded by `e + delta + d1 - d2` and
|
||||
// exists a guard `guardEq` such that `v = v2 - d1 + d2`.
|
||||
exists(SsaVariable v2, Guard guardEq, boolean eqIsTrue, int d1, int d2 |
|
||||
guardEq = eqFlowCond(v, ssaRead(v2, d1), d2, true, eqIsTrue) and
|
||||
result = boundFlowCond(v2, e, delta + d1 - d2, upper, testIsTrue) and
|
||||
// guardEq needs to control guard
|
||||
guardEq.directlyControls(result.getBasicBlock(), eqIsTrue)
|
||||
exists(SsaVariable v2, int d |
|
||||
// equality needs to control guard
|
||||
result.getBasicBlock() = eqSsaCondDirectlyControls(v, v2, d) and
|
||||
result = boundFlowCond(v2, e, delta - d, upper, testIsTrue)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a basic block in which `v1` equals `v2 + delta`.
|
||||
*/
|
||||
private BasicBlock eqSsaCondDirectlyControls(SsaVariable v1, SsaVariable v2, int delta) {
|
||||
exists(Guard guardEq, int d1, int d2, boolean eqIsTrue |
|
||||
guardEq = eqFlowCond(v1, ssaRead(v2, d1), d2, true, eqIsTrue) and
|
||||
delta = d2 - d1 and
|
||||
guardEq.directlyControls(result, eqIsTrue)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user