CodeQL library for Java/Kotlin
codeql/java-all 7.7.3-dev (changelog, source)
Search

Predicate rangeGuard

Holds if guard evaluating to branch ensures that: e <= k when upper = true e >= k when upper = false

Does not include the constant comparison case where the guard directly ensures e == k.

Import path

import semmle.code.java.dataflow.IntegerGuards
predicate rangeGuard(Expr guard, boolean branch, Expr e, int k, boolean upper)