All Downloads are FREE. Search and download functionalities are using the official Maven repository.

soot.jimple.infoflow.problems.rules.forward.StopAfterFirstKFlowsPropagationRule Maven / Gradle / Ivy

The newest version!
package soot.jimple.infoflow.problems.rules.forward;

import java.util.Collection;

import soot.SootMethod;
import soot.jimple.Stmt;
import soot.jimple.infoflow.InfoflowManager;
import soot.jimple.infoflow.data.Abstraction;
import soot.jimple.infoflow.problems.TaintPropagationResults;
import soot.jimple.infoflow.problems.rules.AbstractTaintPropagationRule;
import soot.jimple.infoflow.util.ByReferenceBoolean;

public class StopAfterFirstKFlowsPropagationRule extends AbstractTaintPropagationRule {

	public StopAfterFirstKFlowsPropagationRule(InfoflowManager manager, Abstraction zeroValue,
			TaintPropagationResults results) {
		super(manager, zeroValue, results);
	}

	/**
	 * Checks whether the data flow analysis must be stopped and sets the kill-flag
	 * if so
	 * 
	 * @param killAll
	 *            The variable that receives the kill-flag in case the analysis must
	 *            be stopped
	 */
	private void checkStop(ByReferenceBoolean killAll) {
		if (getManager().getConfig().getStopAfterFirstKFlows() <= getResults().getResults().size())
			killAll.value = true;
	}

	@Override
	public Collection propagateNormalFlow(Abstraction d1, Abstraction source, Stmt stmt, Stmt destStmt,
			ByReferenceBoolean killSource, ByReferenceBoolean killAll) {
		checkStop(killAll);
		return null;
	}

	@Override
	public Collection propagateCallFlow(Abstraction d1, Abstraction source, Stmt stmt, SootMethod dest,
			ByReferenceBoolean killAll) {
		checkStop(killAll);
		return null;
	}

	@Override
	public Collection propagateCallToReturnFlow(Abstraction d1, Abstraction source, Stmt stmt,
			ByReferenceBoolean killSource, ByReferenceBoolean killAll) {
		checkStop(killAll);
		return null;
	}

	@Override
	public Collection propagateReturnFlow(Collection callerD1s, Abstraction calleeD1, Abstraction source, Stmt stmt,
                                                       Stmt retSite, Stmt callSite, ByReferenceBoolean killAll) {
		checkStop(killAll);
		return null;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy