[Soot-list] Found a bug in soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph

Utsav Chokshi uvc.smart.29 at gmail.com
Mon Feb 10 05:50:26 EST 2014


Hello soot-community,
According to my observation there is a BUG in following methods of
HashMutableEdgeLabelledDirectedGraph :
1) ContainsAnyEdge(Object from, Object to)
2) ContainsAnyEdge(Object Label)

TestCase (for 1) : Calling method for nodes for which no edge is added
between them.

In that case , edgesToLabels.get(edge) returns null and so method returns
true.
That is obviously incorrect.

TestCase ( for 2) : Calling method for label that does not exist in graph.

Same consequences happen as above test case.

Solution 1:

ContainsAnyEdge(Object from, Object to){

DGEdge edge= new DGEdge(from, to);
if( edgeToLabels.get(edge) == null || edgesToLabels.get(edge).isEmpty()){
   return false;
}
return true;
}

Solution 2:
Same as above .
Just substitute  hashmap edgesToLabels by labelsToEdges.

- Utsav Chokshi
[ Currently developing Java Slicer using SOOT framework]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140210/867dfe46/attachment.html 


More information about the Soot-list mailing list