You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello there, I'm trying to port my query from deprecated DataFlow to new IR DataFlow. However, due to the lack of clear documentation, I got myself stuck in the below scenarios.
While the query using old DataFlow is like the one below
import cpp
import semmle.code.cpp.Print
import semmle.code.cpp.dataflow.DataFlow
from DataFlow::Nodesource, DataFlow::Nodeendwhereexists(FunctionCallfc|fc.getTarget().hasName("func1")|source.asExpr()=fc)and DataFlow::localFlow(source,end)selectsource,source.getLocation(),end,end.getLocation()
In a nutshell, I want to use dataflow to trace the return value of calling func1. It's obvious that the analysis should track the flow to call of func2.
Running that query turned out well, I got result an entry like:
Then, I port this query to the new IR Dataflow by change
import semmle.code.cpp.dataflow.DataFlow
to
import semmle.code.cpp.dataflow.new.DataFlow
And I cannot get the expected result but only the source node itself
| call to func1 | file:///.../test.c:11:14:11:18 | call to func1 | file:///.../test.c:11:14:11:18 |
I also try to replace the asExpr with some statements that don't exist in old DataFlow, such as asConvertedExpr(), asIndirectExpr(), etc. But no one works out.
I wonder whether this is my problem with using the new IR DataFlow, or the expected incapability of the new IR DataFlow to handle field-involved expression. If I change the example code to the below simple case:
Could you try using taint flow instead of data flow for your query? I.e. semmle.code.cpp.dataflow.new.TaintTracking instead of semmle.code.cpp.dataflow.new.DataFlow.
Could you try using taint flow instead of data flow for your query? I.e. semmle.code.cpp.dataflow.new.TaintTracking instead of semmle.code.cpp.dataflow.new.DataFlow.
Hello there, I'm trying to port my query from deprecated DataFlow to new IR DataFlow. However, due to the lack of clear documentation, I got myself stuck in the below scenarios.
The example C code is like below
While the query using old DataFlow is like the one below
In a nutshell, I want to use dataflow to trace the return value of calling
func1
. It's obvious that the analysis should track the flow to call offunc2
.Running that query turned out well, I got result an entry like:
Then, I port this query to the new IR Dataflow by change
import semmle.code.cpp.dataflow.DataFlow
to
import semmle.code.cpp.dataflow.new.DataFlow
And I cannot get the expected result but only the source node itself
I also try to replace the
asExpr
with some statements that don't exist in old DataFlow, such asasConvertedExpr()
,asIndirectExpr()
, etc. But no one works out.I wonder whether this is my problem with using the new IR DataFlow, or the expected incapability of the new IR DataFlow to handle field-involved expression. If I change the example code to the below simple case:
Both the deprecated DataFlow and new DataFlow can track the call to
func2
.Please help me write the new IR DataFlow query that can track the field-involved case. Thanks in advance.
The text was updated successfully, but these errors were encountered: