DFG Fixes: Inconsistencies, Problems, Discussionworthy #578
konradweiss
started this conversation in
Show and tell
Replies: 2 comments
-
Decisions:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
How do we model currently the data flows for an "unresolvable call"? How is the Where and how should this be implemented? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Specific data flows of the code below are extracted to show how the DFG is build and where problems can be identfied.
Calls
Info
Data flows from args to parameters over expressions are propagated to the return statement and over the
FunctionDeclaration
-Node back to the call.The implicit Constructor is connected to the
ConstructExpression
The implicit return is also connected to the main
Problem
IMO there should definitely be a DFG Edge between the
NewExpression
and the containedConstructExpression
Discussion
For a security Analysis we may want to be on the save side and connect args to the call with a dfg edge if we could not resolve the function target.
ConditionalOperator
Info
Data used in a condition flows to the root node of the enclosing statement to use its result and know the semantic of what it is used for (the root node represents the context of use).
Data in expressions that use
=
flows over the operator=
Discussion
Here I see something that could be perceived as inconsistency: The DFs on the left, toward to root node go over the
=
-operator as there it is and expression, while the DFs to theVariableDeclaration
do not go over the=
operator. Here we could let the values always flow over the=
-Operator, and ignore the LHS-Reference. This would also solve a Problem that we see later with the self-operators. However, this is not something that arises from algorithm problemControlFlowSensitivity
Info
Here again we see the condition being evaluated and flowing to the root node of the
IfStatement
The ControlFlowSensitivity can be seen on the right side where the upper
a
is used in the print outside of the if and has to consider all values written in the branches, and the lowera
that only has to consider the most recent write in its own branch.Returns
Problem
I identified an issue that apparently only arises when we have multiple returns in a function, only one return has a DFG-Edge to the Function root, and all should have one
SelfOperators
Problem
Due to some changes the reference of the previous value to the references got lost. In this image we are missing a DFG-Edge from the
Literal
on the left side to the++
and one from the result of++
or its reference to the+=
. This is an issue that I thought we solved but appears to still be there. This is an additional reason to used the operator=
or++
and+=
as data flow start to points-of-use and Declarations.ImplicitReturn
Discussion
A DF from a function with return type
void
. Nothing is actually returned but we still have a DF. This DF might be acceptable because (1)void
is a type in some languages and (2) it helps in modelling other function calls.Beta Was this translation helpful? Give feedback.
All reactions