mate_query.cpg.query.dataflow module

Dataflow helpers.

mate_query.cpg.query.dataflow.get_pointer_arguments(cpg: mate_query.db.Graph, function_name: str) sqlalchemy.orm.query.Query

Returns a query for all Argument nodes which are pointers.

Args:

Argument: the sql Argument object function_name (string)

Returns:

Query which can be evaluated for Argument node(s)

Parameters
Return type

sqlalchemy.orm.query.Query

mate_query.cpg.query.dataflow.memory_location_of_pointer_arg(Node_: mate_query.cpg.models.core.node.Node, Edge_: mate_query.cpg.models.core.edge.Edge, call_uuid: str, argument_no: int) mate_query.cpg.models.core.node.Node

Returns the Memory Location node pointed to by the argument_number’th argument of a function.

If a function takes pointer arguments and modifies the memory those arguments point to then data flows through those pointers. To allow you to trace that dataflow, you need to find the memory locations of those pointer arguments, and then perform a dataflow query from there. This function returns the memory location of the operand_no’th pointer argument.

Args:

Node_: the Node sql object Edge_: the Edge sql object call_uuid (string) argument_no (int)

Returns:

Node_: the memory location from which to trace dataflow

Parameters
Return type

mate_query.cpg.models.core.node.Node