Skip to content

Commit

Permalink
Remove nonsensical taint analysis rule
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Jun 8, 2022
1 parent 006f441 commit 6d09c3c
Showing 1 changed file with 4 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -776,24 +776,11 @@ private static function taintAssignment(
): void {
$parent_nodes = $type->parent_nodes;

$unspecialized_parent_nodes = array_filter(
$parent_nodes,
static fn($parent_node): bool => !$parent_node->specialization_key
);

$specialized_parent_nodes = array_filter(
$parent_nodes,
static fn($parent_node): bool => (bool) $parent_node->specialization_key
);

$new_parent_nodes = [];

foreach ($specialized_parent_nodes as $parent_node) {
$new_parent_node = DataFlowNode::getForAssignment($var_id, $var_location);
$new_parent_node->specialization_key = $parent_node->specialization_key;
$new_parent_node = DataFlowNode::getForAssignment($var_id, $var_location);
$data_flow_graph->addNode($new_parent_node);
$new_parent_nodes = [$new_parent_node->id => $new_parent_node];

$data_flow_graph->addNode($new_parent_node);
$new_parent_nodes += [$new_parent_node->id => $new_parent_node];
foreach ($parent_nodes as $parent_node) {
$data_flow_graph->addPath(
$parent_node,
$new_parent_node,
Expand All @@ -803,22 +790,6 @@ private static function taintAssignment(
);
}

if ($unspecialized_parent_nodes) {
$new_parent_node = DataFlowNode::getForAssignment($var_id, $var_location);
$data_flow_graph->addNode($new_parent_node);
$new_parent_nodes += [$new_parent_node->id => $new_parent_node];

foreach ($unspecialized_parent_nodes as $parent_node) {
$data_flow_graph->addPath(
$parent_node,
$new_parent_node,
'=',
$added_taints,
$removed_taints
);
}
}

$type->parent_nodes = $new_parent_nodes;
}

Expand Down

0 comments on commit 6d09c3c

Please sign in to comment.