case FKind.FlatSESEEnterNode:
case FKind.FlatSESEExitNode:
case FKind.FlatGenReachNode:
+ case FKind.FlatExit:
return true;
case FKind.FlatCastNode:
FlatCastNode fcn=(FlatCastNode)fn;
return out;
}
+ public TaintSet add(Taint t) {
+ TaintSet newt=new TaintSet();
+ newt.taints.addAll(taints);
+ newt.taints.add(t);
+ return (TaintSet) Canonical.makeCanonical(newt);
+ }
+
+ public TaintSet merge(TaintSet ts) {
+ TaintSet newt=new TaintSet();
+ newt.taints.addAll(taints);
+ newt.taints.addAll(ts.taints);
+ return (TaintSet) Canonical.makeCanonical(newt);
+ }
+
protected TaintSet() {
taints = new HashSet<Taint>();
}
import IR.Flat.*;
import IR.*;
import Analysis.Pointer.AllocFactory.AllocNode;
+import Analysis.Disjoint.Taint;
+import Analysis.Disjoint.TaintSet;
public class Edge {
FieldDescriptor fd;
TempDescriptor srcvar;
AllocNode dst;
int statuspredicate;
+ TaintSet taints;
+
public static final int SNGSNG=1;
public static final int SNGSUM=2;
public static final int SUMSNG=4;
return hashcode;
}
+ public Edge addTaint(Taint t) {
+ Edge newe=copy();
+ if (newe.taints==null)
+ newe.taints=TaintSet.factory(t);
+ else
+ newe.taints=newe.taints.add(t);
+ return newe;
+ }
+
public boolean equals(Object o) {
if (o instanceof Edge) {
Edge e=(Edge) o;
e.srcvar=srcvar;
e.dst=dst;
e.statuspredicate=statuspredicate;
+ if (taints!=null)
+ e.taints=taints;
return e;
}
return this;
Edge newe=copy();
newe.statuspredicate=mergeStatus(statuspredicate, e.statuspredicate);
+ if (e.taints!=null) {
+ if (newe.taints==null)
+ newe.taints=e.taints;
+ else
+ newe.taints=newe.taints.merge(taints);
+ }
return newe;
}
import Analysis.Liveness;
import Analysis.Pointer.BasicBlock.BBlock;
import Analysis.Pointer.AllocFactory.AllocNode;
+import Analysis.Disjoint.Taint;
import java.io.*;
public class Pointer {
}
//DEBUG
- if (false) {
+ if (true) {
int debugindex=0;
for(Map.Entry<BBlock, Graph> e:bbgraphMap.entrySet()) {
Graph g=e.getValue();
}
}
+ Delta processSESEEnter(FlatSESEEnterNode sese, Delta delta, Graph graph) {
+ for (TempDescriptor tmp:sese.getInVarSet()) {
+ Taint taint=Taint.factory(sese, null, tmp, null, sese, null);
+ if (delta.getInit()) {
+ MySet<Edge> edges=GraphManip.getEdges(graph, delta, tmp);
+ for(Edge e:edges) {
+ Edge newe=e.addTaint(taint);
+ delta.addVarEdge(newe);
+ }
+ } else {
+ MySet<Edge> edges=GraphManip.getDiffEdges(delta, tmp);
+ for(Edge e:edges) {
+ Edge newe=e.addTaint(taint);
+ delta.addVarEdge(newe);
+ }
+ }
+ }
+ applyDiffs(graph, delta);
+ return delta;
+ }
+
+
/* This function compute the edges for the this variable for a
* callee if it exists. */