diff --git a/src/main/java/br/unb/cic/analysis/df/ConfluentTaintedAnalysis.java b/src/main/java/br/unb/cic/analysis/df/ConfluentTaintedAnalysis.java index ddd19d3d..86fa5091 100644 --- a/src/main/java/br/unb/cic/analysis/df/ConfluentTaintedAnalysis.java +++ b/src/main/java/br/unb/cic/analysis/df/ConfluentTaintedAnalysis.java @@ -2,7 +2,7 @@ import br.unb.cic.analysis.AbstractMergeConflictDefinition; import br.unb.cic.analysis.model.Conflict; -import br.unb.cic.analysis.model.DoubleSourceConflict; +import br.unb.cic.analysis.model.ConfluenceConflictReport; import br.unb.cic.analysis.model.Statement; import soot.Body; import soot.Local; @@ -30,10 +30,13 @@ protected FlowSet gen(Unit u, FlowSet } } else if (u.getDefBoxes().size() > 0) { - u.getUseBoxes().forEach(v -> { + u.getUseBoxes().stream().filter(v -> v.getValue() instanceof Local).forEach(v -> { + Local local = (Local) v.getValue(); in.forEach(sourceDefs -> { - if(sourceDefs.getLocal() == v.getValue()){ //if variable in the analyzed stmt is present in IN - u.getDefBoxes().forEach(def -> { + if(sourceDefs.getLocal().equals(local)){ //if variable in the analyzed stmt is present in IN + u.getDefBoxes().stream() + .filter(def -> def.getValue() instanceof Local) + .forEach(def -> { res.add(new DataFlowAbstraction((Local)def.getValue(), findStatement(u))); //add variable assigned as the stmt to IN }); } @@ -64,7 +67,7 @@ protected void detectConflict(FlowSet in, Unit u){ for(Statement source: sources){ for(Statement sink: sinks){ - Conflict c = new DoubleSourceConflict(source, sink, findStatement(u)); + Conflict c = new ConfluenceConflictReport(source, sink, findStatement(u)); Collector.instance().addConflict(c); } } diff --git a/src/main/java/br/unb/cic/analysis/df/SourceSinkConfluenceAnalysis.java b/src/main/java/br/unb/cic/analysis/df/SourceSinkConfluenceAnalysis.java index b61b297a..d740244f 100644 --- a/src/main/java/br/unb/cic/analysis/df/SourceSinkConfluenceAnalysis.java +++ b/src/main/java/br/unb/cic/analysis/df/SourceSinkConfluenceAnalysis.java @@ -2,7 +2,7 @@ import br.unb.cic.analysis.AbstractMergeConflictDefinition; import br.unb.cic.analysis.model.Conflict; -import br.unb.cic.analysis.model.DoubleSourceConflict; +import br.unb.cic.analysis.model.ConfluenceConflictReport; import br.unb.cic.analysis.model.Statement; import soot.Body; import soot.Local; @@ -56,7 +56,7 @@ protected void detectConflict(FlowSet in, Unit u) { //report the conflicts for(Statement source: sources) { for(Statement sink: sinks) { - Conflict c = new DoubleSourceConflict(source, sink, findStatement(u)); + Conflict c = new ConfluenceConflictReport(source, sink, findStatement(u)); Collector.instance().addConflict(c); } } diff --git a/src/main/java/br/unb/cic/analysis/model/DoubleSourceConflict.java b/src/main/java/br/unb/cic/analysis/model/ConfluenceConflictReport.java similarity index 85% rename from src/main/java/br/unb/cic/analysis/model/DoubleSourceConflict.java rename to src/main/java/br/unb/cic/analysis/model/ConfluenceConflictReport.java index 6c9de669..be7545e2 100644 --- a/src/main/java/br/unb/cic/analysis/model/DoubleSourceConflict.java +++ b/src/main/java/br/unb/cic/analysis/model/ConfluenceConflictReport.java @@ -2,13 +2,13 @@ import java.util.Objects; -public class DoubleSourceConflict extends Conflict { +public class ConfluenceConflictReport extends Conflict { protected String targetClassName; protected String targetMethodName; protected Integer targetLineNumber; - public DoubleSourceConflict(Statement source, Statement sink, Statement target) { + public ConfluenceConflictReport(Statement source, Statement sink, Statement target) { super(source, sink); targetClassName = target.getSootClass().getName(); targetMethodName = target.getSootMethod().getName(); @@ -20,7 +20,7 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; - DoubleSourceConflict that = (DoubleSourceConflict) o; + ConfluenceConflictReport that = (ConfluenceConflictReport) o; return Objects.equals(targetClassName, that.targetClassName) && Objects.equals(targetMethodName, that.targetMethodName) && Objects.equals(targetLineNumber, that.targetLineNumber);