Java: locations for range analysis

This commit is contained in:
Rasmus Lerchedahl Petersen
2024-11-15 11:28:38 +01:00
parent c8c15a0899
commit cd5509a0f9
5 changed files with 23 additions and 19 deletions

View File

@@ -75,7 +75,7 @@ private import semmle.code.java.Maps
import Bound
private import codeql.rangeanalysis.RangeAnalysis
module Sem implements Semantic {
module Sem implements Semantic<Location> {
private import java as J
private import SSA as SSA
private import RangeUtils as RU
@@ -264,7 +264,7 @@ module Sem implements Semantic {
predicate conversionCannotOverflow = safeCast/2;
}
module SignInp implements SignAnalysisSig<Sem> {
module SignInp implements SignAnalysisSig<Location, Sem> {
private import SignAnalysis
private import internal.rangeanalysis.Sign
@@ -281,7 +281,7 @@ module SignInp implements SignAnalysisSig<Sem> {
predicate semMayBeNegative(Sem::Expr e) { exprSign(e) = TNeg() }
}
module Modulus implements ModulusAnalysisSig<Sem> {
module Modulus implements ModulusAnalysisSig<Location, Sem> {
class ModBound = Bound;
private import codeql.rangeanalysis.ModulusAnalysis as Mod
@@ -307,7 +307,7 @@ module IntDelta implements DeltaSig {
Delta fromFloat(float f) { result = f }
}
module JavaLangImpl implements LangSig<Sem, IntDelta> {
module JavaLangImpl implements LangSig<Location, Sem, IntDelta> {
/**
* Holds if `e >= bound` (if `upper = false`) or `e <= bound` (if `upper = true`).
*/
@@ -379,7 +379,7 @@ module Bounds implements BoundSig<Location, Sem, IntDelta> {
}
}
module Overflow implements OverflowSig<Sem, IntDelta> {
module Overflow implements OverflowSig<Location, Sem, IntDelta> {
predicate semExprDoesNotOverflow(boolean positively, Sem::Expr expr) {
positively = [true, false] and exists(expr)
}

View File

@@ -9,7 +9,7 @@ private import semmle.code.java.Constants
private import semmle.code.java.dataflow.RangeAnalysis
private import codeql.rangeanalysis.internal.RangeUtils
private module U = MakeUtils<Sem, IntDelta>;
private module U = MakeUtils<Location, Sem, IntDelta>;
private predicate backEdge = U::backEdge/3;