From 6196e8ac78afb5f843f2f177548f354001ba71d5 Mon Sep 17 00:00:00 2001 From: yeom Date: Mon, 28 Sep 2009 23:58:43 +0000 Subject: [PATCH] bug fix --- .../OwnershipAnalysis/OwnershipGraph.java | 31 ++++++++++++++++++- .../OwnershipAnalysis/ReferenceEdge.java | 6 +++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 6a703241..a731a5a4 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -212,6 +212,11 @@ public class OwnershipGraph { assert edge == referencee.getReferenceFrom(referencer, type, field); + +// int oldTaint=edge.getTaintIdentifier(); +// if(referencer instanceof HeapRegionNode){ +// depropagateTaintIdentifier((HeapRegionNode)referencer,oldTaint,new HashSet()); +// } referencer.removeReferencee(edge); referencee.removeReferencer(edge); @@ -362,6 +367,9 @@ public class OwnershipGraph { null, false, betaY.intersection(betaHrn) ); + + int newTaintIdentifier=getTaintIdentifierFromHRN(hrnHrn); + edgeNew.setTaintIdentifier(newTaintIdentifier); addReferenceEdge(lnX, hrnHrn, edgeNew); } @@ -485,7 +493,7 @@ public class OwnershipGraph { edgeExisting.getBeta().union( edgeNew.getBeta() ) ); int newTaintIdentifier=getTaintIdentifierFromHRN(hrnY); - edgeExisting.tainedBy(newTaintIdentifier); + edgeExisting.unionTaintIdentifier(newTaintIdentifier); // a new edge here cannot be reflexive, so existing will // always be also not reflexive anymore edgeExisting.setIsInitialParam( false ); @@ -4716,4 +4724,25 @@ public class OwnershipGraph { } + public void depropagateTaintIdentifier(HeapRegionNode hrn, int newTaintIdentifier, HashSet visitedSet){ + + HashSet setEdge=hrn.referencers; + Iterator iter=setEdge.iterator(); + while(iter.hasNext()){ + ReferenceEdge edge= iter.next(); + edge.minusTaintIdentifier(newTaintIdentifier); + if(edge.getSrc() instanceof HeapRegionNode){ + + HeapRegionNode refHRN=(HeapRegionNode)edge.getSrc(); + //check whether it is reflexive edge + if(!refHRN.equals(hrn) && !visitedSet.contains(refHRN)){ + visitedSet.add(refHRN); + depropagateTaintIdentifier((HeapRegionNode)edge.getSrc(),newTaintIdentifier,visitedSet); + } + + } + } + + } + } diff --git a/Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java b/Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java index 669da7bd..4cf3814f 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java +++ b/Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java @@ -223,7 +223,7 @@ public class ReferenceEdge { edgeLabel += "*init*\\n"; } - edgeLabel+="*taint*="+taintIdentifier+"\\n"; + edgeLabel+="*taint*="+Integer.toBinaryString(taintIdentifier)+"\\n"; edgeLabel += beta.toStringEscapeNewline(); @@ -251,6 +251,10 @@ public class ReferenceEdge { taintIdentifier=taintIdentifier | newTaint; } + public void minusTaintIdentifier(int removedTaint){ + taintIdentifier = taintIdentifier & (~removedTaint); + } + public int getTaintIdentifier(){ return taintIdentifier; } -- 2.34.1