mirror of
https://github.com/github/codeql.git
synced 2026-06-25 14:47:04 +02:00
37 lines
1008 B
Plaintext
37 lines
1008 B
Plaintext
/**
|
|
* Provides classes for representing abstract bounds for use in, for example, range analysis.
|
|
*/
|
|
overlay[local?]
|
|
module;
|
|
|
|
private import java as J
|
|
private import semmle.code.java.dataflow.SSA
|
|
private import semmle.code.java.dataflow.RangeUtils as RU
|
|
private import codeql.rangeanalysis.Bound as SharedBound
|
|
|
|
private module BoundDefs implements SharedBound::BoundDefinitions<J::Location> {
|
|
class SsaVariable extends Ssa::SsaDefinition {
|
|
/** Gets a use of this variable. */
|
|
Expr getAUse() { result = super.getARead() }
|
|
}
|
|
|
|
class SsaSourceVariable = Ssa::SourceVariable;
|
|
|
|
class Type = J::Type;
|
|
|
|
class Expr = J::Expr;
|
|
|
|
class IntegralType = J::IntegralType;
|
|
|
|
class ConstantIntegerExpr = RU::ConstantIntegerExpr;
|
|
|
|
/** Holds if `e` is a bound expression and it is not an SSA variable read. */
|
|
predicate interestingExprBound(Expr e) {
|
|
e.(J::FieldRead).getField() instanceof J::ArrayLengthField
|
|
}
|
|
}
|
|
|
|
module BoundImpl = SharedBound::Bound<J::Location, BoundDefs>;
|
|
|
|
import BoundImpl
|