-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SVFA implementation #20
base: develop
Are you sure you want to change the base?
Conversation
val left = unit.asInstanceOf[soot.jimple.AssignStmt].getLeftOp | ||
allocationSites += (left -> createNode(m, unit)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alterei somente estas duas linhas, caso remova-as, fica somente com o algoritmo de SVFA, funcionando somente com New, New Array e StringConstant
} | ||
|
||
//add new allocation sites | ||
updateAllocationSites(method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modificação crucial, atualiza todos os allocationSites quando visita um novo método.
@@ -464,7 +467,10 @@ class Graph() { | |||
sourceNodes.foreach(source => { | |||
sinkNodes.foreach(sink => { | |||
val paths = findPath(source, sink) | |||
conflicts = conflicts ++ paths | |||
val pathsHaveSameSourceAndSinkRootTraversedLine: Boolean = conflicts.exists(c => paths.exists(p => c.head.line() == p.head.line() && c.last.line() == p.last.line())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignorar caminhos repetidos com mesma origem e destino.
@@ -275,7 +326,7 @@ abstract class JSVFA extends SVFA with Analysis with FieldSensitiveness with Obj | |||
|
|||
if(analyze(callStmt.base) == SinkNode) { | |||
defsToCallOfSinkMethod(callStmt, exp, caller, defs) | |||
return // TODO: we are not exploring the body of a sink method. | |||
// return // TODO: we are not exploring the body of a sink method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Não estava visitando métodos que eram sink. Removi o return.
@@ -285,6 +336,19 @@ abstract class JSVFA extends SVFA with Analysis with FieldSensitiveness with Obj | |||
svg.addNode(source) | |||
} | |||
|
|||
//Add edge from defs statements to invoke statement use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Não estava adicionando arestas para invoke statements, por exemplo:
- stack1 = class...
- invoke stack1.m();
Não adicionava aresta de stack1 (linha 1) para o statement invoke (linha 2).
@@ -396,6 +466,11 @@ abstract class JSVFA extends SVFA with Analysis with FieldSensitiveness with Obj | |||
allocationNodes = findFieldStores(base.asInstanceOf[Local], ref.getField) | |||
} | |||
|
|||
//Search the defined allocationSites fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Procura por algum allocationSite de fields
@@ -699,6 +776,21 @@ abstract class JSVFA extends SVFA with Analysis with FieldSensitiveness with Obj | |||
return res | |||
} | |||
|
|||
// Search the defined allocationSites fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verifica se tem algum allocationSite de um de determinado field.
val right = unit.asInstanceOf[soot.jimple.AssignStmt].getRightOp | ||
if (right.isInstanceOf[soot.jimple.InstanceInvokeExpr]){ | ||
val method = right.asInstanceOf[soot.jimple.InstanceInvokeExpr] | ||
updateAllocationSites(method.getMethod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se na direita também tiver uma chamada de método, atualiza os allocation sites. Por exemplo: stack0 = stack1.m()
} | ||
} | ||
|
||
if (unit.isInstanceOf[soot.jimple.InvokeStmt]){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se for apenas uma chamada direta de método, atualiza os allocation sites. Por exemplo: stack1.m()
|
||
githubOwner := "rbonifacio" | ||
githubOwner := "galilasmb" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alterar isso para o de Rodrigo.
In progress: should we add all assignments or only with new?
Fix: