mirror of
https://github.com/github/codeql.git
synced 2026-03-01 05:13:41 +01:00
Merge pull request #4268 from tamasvajk/feature/java-range-analysis-fn
Java: Fix range analysis false negative
This commit is contained in:
@@ -252,6 +252,15 @@ private Guard boundFlowCond(SsaVariable v, Expr e, int delta, boolean upper, boo
|
||||
or
|
||||
result = eqFlowCond(v, e, delta, true, testIsTrue) and
|
||||
(upper = true or upper = false)
|
||||
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)
|
||||
)
|
||||
}
|
||||
|
||||
private newtype TReason =
|
||||
|
||||
Reference in New Issue
Block a user