bug fix
authoryeom <yeom>
Mon, 28 Sep 2009 23:58:43 +0000 (23:58 +0000)
committeryeom <yeom>
Mon, 28 Sep 2009 23:58:43 +0000 (23:58 +0000)
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java

index 6a7032418eb066c1f7f3c0515a33bbac960b0648..a731a5a4cdcfd31b8eba8d73346f3c38b1585cd6 100644 (file)
@@ -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<HeapRegionNode>());
+//    }
 
     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<HeapRegionNode> visitedSet){
+         
+         HashSet<ReferenceEdge> setEdge=hrn.referencers;
+         Iterator<ReferenceEdge> 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);
+                         }
+                        
+                 }
+         }       
+         
+  }
+  
 }
index 669da7bd91df7ec9bd128efb1e97d31b2f81258c..4cf3814f3d7accc91b511b2ab80c1f8aaf36c552 100644 (file)
@@ -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;
   }