Module BufferOverrunDomain.AliasTarget
type alias_typ
=
type t
=
|
Simple of
{
i : IR.IntLit.t;
java_tmp : AbsLoc.Loc.t option;
}
Since Sil distinguishes logical and program variables, we need a relation for pruning values of program variables. For example, a C statement
if(x){...}
is translated to%r=load(x); if(%r){...}
in Sil. At the load statement, we record the alias between the values of%r
andx
, then we can prune not only the value of%r
, but also that ofx
inside the if branch. Thejava_tmp
field is an additional slot for keeping one more alias of temporary variable in Java. Thei
field is to express%r=load(x)+i
.|
Empty
For pruning
vector.length
withvector::empty()
results, we adopt a specific relation between%r
andv->elements
, where%r=v.empty()
. So, if%r!=0
,v
's array length (v->elements->length
) is pruned by=0
. On the other hand, if%r==0
,v
's array length is pruned by>=1
.|
Size of
{
alias_typ : alias_typ;
i : IR.IntLit.t;
java_tmp : AbsLoc.Loc.t option;
}
This is for pruning vector's length. When there is a function call,
%r=x.size()
, the alias target for%r
becomesAliasTarget.size {l=x.elements}
. Thejava_tmp
field is an additional slot for keeping one more alias of temporary variable in Java. Thei
field is to express%r=x.size()+i
, which is required to follow the semantics ofArray.add
inside loops precisely.|
Fgets
This is for pruning return values of
fgets
. If the result offgets
is not null, the length of return value will be pruned to greater than or equal to 1.|
IteratorSimple of
{
i : IR.IntLit.t;
java_tmp : AbsLoc.Loc.t option;
}
This is for tracking a relation between an iterator offset and an integer value. If
%r
has an alias toIteratorSimple {l; i}
, which means that%r's iterator offset
is same tol
.|
IteratorOffset of
{
alias_typ : alias_typ;
i : IR.IntLit.t;
java_tmp : AbsLoc.Loc.t option;
}
This is for tracking a relation between an iterator offset and the length of the underlying collection. If
%r
has an alias toIteratorOffset {l; i}
, which means that%r's iterator offset
is same tolength(l)+i
.|
IteratorHasNext of
{
java_tmp : AbsLoc.Loc.t option;
}
This is for tracking return values of the
hasNext
function. If%r
has an alias toHasNext {l}
, which means that%r
is same tol.hasNext()
.|
IteratorNextObject of
{
objc_tmp : AbsLoc.Loc.t option;
}
This is for tracking the return values of
nextObject
function. If%r
has an alias tonextObject {l}
, which means that%r
is the same tol.nextObject()
.|
Top
Relations between values of logical variables(registers) and program variables
include Absint.AbstractDomain.S with type t := t
include Absint.AbstractDomain.NoJoin
include IStdlib.PrettyPrintable.PrintableType
val pp : IStdlib.PrettyPrintable.F.formatter -> t -> unit