/** * Copies the given access path with a new base value, but retains the base type * * @param original The original access path * @param val The new value * @return The new access path with the exchanged value */ public AccessPath copyWithNewValue(AccessPath original, Value val) { return copyWithNewValue(original, val, original.getBaseType(), false); }
public Abstraction deriveConditionalAbstractionCall(Unit conditionalCallSite) { assert this.isAbstractionActive(); assert conditionalCallSite != null; Abstraction abs = deriveNewAbstractionMutable(AccessPath.getEmptyAccessPath(), (Stmt) conditionalCallSite); if (abs == null) return null; // Postdominators are only kept intraprocedurally in order to not // mess up the summary functions with caller-side information abs.postdominators = null; return abs; }
public Abstraction deriveNewAbstraction(AccessPath p, Stmt currentStmt, boolean isImplicit) { // If the new abstraction looks exactly like the current one, there is // no need to create a new object if (this.accessPath.equals(p) && this.currentStmt == currentStmt && this.isImplicit == isImplicit) return this; Abstraction abs = deriveNewAbstractionMutable(p, currentStmt); if (abs == null) return null; abs.isImplicit = isImplicit; return abs; }
/** * Merges the two given access paths , i.e., adds the fields of ap2 to ap1. * * @param ap1 The access path to which to append the fields * @param ap2 The access path whose fields to append to ap1 * @return The new access path */ public AccessPath merge(AccessPath ap1, AccessPath ap2) { return appendFields(ap1, ap2.getFields(), ap2.getFieldTypes(), ap2.getTaintSubFields()); }
/** * value val gets new base, fields are preserved. * * @param original The original access path * @param val The new base value * @param reduceBases True if circular types shall be reduced to bases * @return This access path with the base replaced by the value given in the val * parameter */ public AccessPath copyWithNewValue(AccessPath original, Value val, Type newType, boolean cutFirstField, boolean reduceBases) { return copyWithNewValue(original, val, newType, cutFirstField, reduceBases, original.getArrayTaintType()); }
public Abstraction getActiveCopy() { if (this.isAbstractionActive()) return this; Abstraction a = clone(); a.sourceContext = null; a.activationUnit = null; return a; }
public AccessPath createAccessPath(Value val, SootField[] appendingFields, Type valType, Type[] appendingFieldTypes, boolean taintSubFields, boolean cutFirstField, boolean reduceBases, ArrayTaintType arrayTaintType) { return createAccessPath(val, appendingFields, valType, appendingFieldTypes, taintSubFields, cutFirstField, reduceBases, arrayTaintType, false); }
public Abstraction injectSourceContext(SourceContext sourceContext) { if (this.sourceContext != null && this.sourceContext.equals(sourceContext)) return this; Abstraction abs = clone(); abs.predecessor = null; abs.neighbors = null; abs.sourceContext = sourceContext; abs.currentStmt = this.currentStmt; return abs; }
public static Abstraction getZeroAbstraction(boolean flowSensitiveAliasing) { Abstraction zeroValue = new Abstraction(AccessPath.getZeroAccessPath(), null, false, false); Abstraction.flowSensitiveAliasing = flowSensitiveAliasing; return zeroValue; }
@Override public SourceContext clone() { SourceContext sc = new SourceContext(definition, accessPath, stmt, userData); assert sc.equals(this); return sc; }
@Override public AccessPath clone() { // The empty access path is a singleton if (this == emptyAccessPath) return this; AccessPath a = new AccessPath(value, fields, baseType, fieldTypes, taintSubFields, cutOffApproximation, arrayTaintType, canHaveImmutableAliases); assert a.equals(this); return a; }
@Override public String toString() { return (isAbstractionActive() ? "" : "_") + accessPath.toString() + " | " + (activationUnit == null ? "" : activationUnit.toString()) + ">>"; }
@Override public int computeHashCode(Abstraction abs) { if (abs.neighborHashCode != 0) return abs.neighborHashCode; final int prime = 31; int result = 1; result = prime * result + abs.hashCode(); result = prime * result + ((abs.predecessor == null) ? 0 : abs.predecessor.hashCode()); abs.neighborHashCode = result; return result; }
@Override public String toString() { return super.toString() + "\n\ton Path: " + getAbstractionPath(); } }
/** * value val gets new base, fields are preserved. * * @param original The original access path * @param val The new base value * @return This access path with the base replaced by the value given in the val * parameter */ public AccessPath copyWithNewValue(AccessPath original, Value val, Type newType, boolean cutFirstField) { return copyWithNewValue(original, val, newType, cutFirstField, true); }
/** * Extends the taint propagation path with the given abstraction * * @param abs The abstraction to put on the taint propagation path * @return The new taint propagation path If this path would contain a loop, * null is returned instead of the looping path. */ public SourceContextAndPath extendPath(Abstraction abs) { return extendPath(abs, null); }
protected Abstraction(AccessPath apToTaint, SourceContext sourceContext, boolean exceptionThrown, boolean isImplicit) { this.sourceContext = sourceContext; this.accessPath = apToTaint; this.activationUnit = null; this.exceptionThrown = exceptionThrown; this.neighbors = null; this.isImplicit = isImplicit; this.currentStmt = sourceContext == null ? null : sourceContext.getStmt(); }
@Override public IMemoryManager<Abstraction, Unit> getMemoryManager(boolean tracingEnabled, PathDataErasureMode erasePathData) { return new FlowDroidMemoryManager(tracingEnabled, erasePathData); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((abstraction == null) ? 0 : abstraction.hashCode()); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((abstraction == null) ? 0 : abstraction.hashCode()); return result; }