Search in sources :

Example 1 with StringConstantNode

use of soot.jimple.spark.pag.StringConstantNode in project soot by Sable.

the class FullSensitiveNode method heap_sensitive_intersection.

@Override
public boolean heap_sensitive_intersection(IVarAbstraction qv) {
    int i, j;
    FullSensitiveNode qn;
    SegmentNode p, q, pt[], qt[];
    boolean localToSameMethod;
    qn = (FullSensitiveNode) qv;
    localToSameMethod = (enclosingMethod() == qv.enclosingMethod());
    for (Iterator<AllocNode> it = pt_objs.keySet().iterator(); it.hasNext(); ) {
        AllocNode an = it.next();
        if (an instanceof ClassConstantNode)
            continue;
        if (an instanceof StringConstantNode)
            continue;
        qt = qn.find_points_to(an);
        if (qt == null)
            continue;
        pt = find_points_to(an);
        for (i = 0; i < GeometricManager.Divisions; ++i) {
            p = pt[i];
            while (p != null) {
                for (j = 0; j < GeometricManager.Divisions; ++j) {
                    q = qt[j];
                    while (q != null) {
                        if (localToSameMethod) {
                            // We can use a more precise alias testing
                            if (p.intersect(q))
                                return true;
                        } else {
                            if (p.projYIntersect(q))
                                return true;
                        }
                        q = q.next;
                    }
                }
                p = p.next;
            }
        }
    }
    return false;
}
Also used : AllocNode(soot.jimple.spark.pag.AllocNode) StringConstantNode(soot.jimple.spark.pag.StringConstantNode) ClassConstantNode(soot.jimple.spark.pag.ClassConstantNode) PlainConstraint(soot.jimple.spark.geom.dataRep.PlainConstraint) SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Example 2 with StringConstantNode

use of soot.jimple.spark.pag.StringConstantNode in project soot by Sable.

the class HeapInsNode method heap_sensitive_intersection.

/**
 * Query if this pointer and qv could point to the same object under any contexts
 */
@Override
public boolean heap_sensitive_intersection(IVarAbstraction qv) {
    int i, j;
    HeapInsNode qn;
    SegmentNode p, q, pt[], qt[];
    qn = (HeapInsNode) qv;
    for (Iterator<AllocNode> it = pt_objs.keySet().iterator(); it.hasNext(); ) {
        AllocNode an = it.next();
        if (an instanceof ClassConstantNode)
            continue;
        if (an instanceof StringConstantNode)
            continue;
        qt = qn.find_points_to(an);
        if (qt == null)
            continue;
        pt = find_points_to(an);
        for (i = 0; i < HeapInsIntervalManager.Divisions; ++i) {
            p = pt[i];
            while (p != null) {
                for (j = 0; j < HeapInsIntervalManager.Divisions; ++j) {
                    q = qt[j];
                    while (q != null) {
                        if (quick_intersecting_test(p, q))
                            return true;
                        q = q.next;
                    }
                }
                p = p.next;
            }
        }
    }
    return false;
}
Also used : AllocNode(soot.jimple.spark.pag.AllocNode) StringConstantNode(soot.jimple.spark.pag.StringConstantNode) ClassConstantNode(soot.jimple.spark.pag.ClassConstantNode) PlainConstraint(soot.jimple.spark.geom.dataRep.PlainConstraint) SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Example 3 with StringConstantNode

use of soot.jimple.spark.pag.StringConstantNode in project soot by Sable.

the class PtInsNode method heap_sensitive_intersection.

/**
 * Query if this pointer and qv could point to the same object under any contexts
 */
@Override
public boolean heap_sensitive_intersection(IVarAbstraction qv) {
    int i, j;
    PtInsNode qn;
    SegmentNode p, q, pt[], qt[];
    qn = (PtInsNode) qv;
    for (Iterator<AllocNode> it = pt_objs.keySet().iterator(); it.hasNext(); ) {
        AllocNode an = it.next();
        if (an instanceof StringConstantNode)
            continue;
        qt = qn.find_points_to(an);
        if (qt == null)
            continue;
        pt = find_points_to(an);
        for (i = 0; i < PtInsIntervalManager.Divisions; ++i) {
            p = pt[i];
            while (p != null) {
                for (j = 0; j < PtInsIntervalManager.Divisions; ++j) {
                    q = qt[j];
                    while (q != null) {
                        if (quick_intersecting_test(p, q))
                            return true;
                        q = q.next;
                    }
                }
                p = p.next;
            }
        }
    }
    return false;
}
Also used : AllocNode(soot.jimple.spark.pag.AllocNode) StringConstantNode(soot.jimple.spark.pag.StringConstantNode) PlainConstraint(soot.jimple.spark.geom.dataRep.PlainConstraint) SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Example 4 with StringConstantNode

use of soot.jimple.spark.pag.StringConstantNode in project soot by Sable.

the class OnFlyCallGraph method updatedNode.

public void updatedNode(VarNode vn) {
    Object r = vn.getVariable();
    if (!(r instanceof Local))
        return;
    final Local receiver = (Local) r;
    final Context context = vn.context();
    PointsToSetInternal p2set = vn.getP2Set().getNewSet();
    if (ofcgb.wantTypes(receiver)) {
        p2set.forall(new P2SetVisitor() {

            public final void visit(Node n) {
                if (n instanceof AllocNode)
                    ofcgb.addType(receiver, context, n.getType(), (AllocNode) n);
            }
        });
    }
    if (ofcgb.wantStringConstants(receiver)) {
        p2set.forall(new P2SetVisitor() {

            public final void visit(Node n) {
                if (n instanceof StringConstantNode) {
                    String constant = ((StringConstantNode) n).getString();
                    ofcgb.addStringConstant(receiver, context, constant);
                } else {
                    ofcgb.addStringConstant(receiver, context, null);
                }
            }
        });
    }
    if (ofcgb.wantInvokeArg(receiver)) {
        p2set.forall(new P2SetVisitor() {

            @Override
            public void visit(Node n) {
                if (n instanceof AllocNode) {
                    AllocNode an = ((AllocNode) n);
                    ofcgb.addInvokeArgDotField(receiver, an.dot(ArrayElement.v()));
                    assert an.getNewExpr() instanceof NewArrayExpr;
                    NewArrayExpr nae = (NewArrayExpr) an.getNewExpr();
                    if (!(nae.getSize() instanceof IntConstant)) {
                        ofcgb.setArgArrayNonDetSize(receiver, context);
                    } else {
                        IntConstant sizeConstant = (IntConstant) nae.getSize();
                        ofcgb.addPossibleArgArraySize(receiver, sizeConstant.value, context);
                    }
                }
            }
        });
        for (Type ty : pag.reachingObjectsOfArrayElement(p2set).possibleTypes()) {
            ofcgb.addInvokeArgType(receiver, context, ty);
        }
    }
}
Also used : MethodOrMethodContext(soot.MethodOrMethodContext) Context(soot.Context) StringConstantNode(soot.jimple.spark.pag.StringConstantNode) PointsToSetInternal(soot.jimple.spark.sets.PointsToSetInternal) Node(soot.jimple.spark.pag.Node) StringConstantNode(soot.jimple.spark.pag.StringConstantNode) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode) Local(soot.Local) Type(soot.Type) AllocNode(soot.jimple.spark.pag.AllocNode) NewArrayExpr(soot.jimple.NewArrayExpr) IntConstant(soot.jimple.IntConstant) P2SetVisitor(soot.jimple.spark.sets.P2SetVisitor)

Aggregations

AllocNode (soot.jimple.spark.pag.AllocNode)4 StringConstantNode (soot.jimple.spark.pag.StringConstantNode)4 PlainConstraint (soot.jimple.spark.geom.dataRep.PlainConstraint)3 SegmentNode (soot.jimple.spark.geom.dataRep.SegmentNode)3 ClassConstantNode (soot.jimple.spark.pag.ClassConstantNode)2 Context (soot.Context)1 Local (soot.Local)1 MethodOrMethodContext (soot.MethodOrMethodContext)1 Type (soot.Type)1 IntConstant (soot.jimple.IntConstant)1 NewArrayExpr (soot.jimple.NewArrayExpr)1 Node (soot.jimple.spark.pag.Node)1 VarNode (soot.jimple.spark.pag.VarNode)1 P2SetVisitor (soot.jimple.spark.sets.P2SetVisitor)1 PointsToSetInternal (soot.jimple.spark.sets.PointsToSetInternal)1