mirror of
https://github.com/danog/psalm.git
synced 2024-11-29 20:28:59 +01:00
Prevent infinite loop while scanning in some situations
This commit is contained in:
parent
4627065d1f
commit
43170a84a9
@ -222,7 +222,7 @@ class TaintFlowGraph extends DataFlowGraph
|
|||||||
/**
|
/**
|
||||||
* @param array<string> $source_taints
|
* @param array<string> $source_taints
|
||||||
* @param array<DataFlowNode> $sinks
|
* @param array<DataFlowNode> $sinks
|
||||||
* @return list<DataFlowNode>
|
* @return array<string, DataFlowNode>
|
||||||
*/
|
*/
|
||||||
private function getChildNodes(
|
private function getChildNodes(
|
||||||
DataFlowNode $generated_source,
|
DataFlowNode $generated_source,
|
||||||
@ -245,6 +245,8 @@ class TaintFlowGraph extends DataFlowGraph
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$destination_node = $this->nodes[$to_id];
|
||||||
|
|
||||||
$new_taints = \array_unique(
|
$new_taints = \array_unique(
|
||||||
\array_diff(
|
\array_diff(
|
||||||
\array_merge($source_taints, $added_taints),
|
\array_merge($source_taints, $added_taints),
|
||||||
@ -254,8 +256,6 @@ class TaintFlowGraph extends DataFlowGraph
|
|||||||
|
|
||||||
\sort($new_taints);
|
\sort($new_taints);
|
||||||
|
|
||||||
$destination_node = $this->nodes[$to_id];
|
|
||||||
|
|
||||||
if (isset($visited_source_ids[$to_id][implode(',', $new_taints)])) {
|
if (isset($visited_source_ids[$to_id][implode(',', $new_taints)])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -441,7 +441,8 @@ class TaintFlowGraph extends DataFlowGraph
|
|||||||
$new_destination->specialized_calls = $generated_source->specialized_calls;
|
$new_destination->specialized_calls = $generated_source->specialized_calls;
|
||||||
$new_destination->path_types = array_merge($generated_source->path_types, [$path_type]);
|
$new_destination->path_types = array_merge($generated_source->path_types, [$path_type]);
|
||||||
|
|
||||||
$new_sources[] = $new_destination;
|
$key = $to_id . ' ' . \json_encode($new_destination->specialized_calls);
|
||||||
|
$new_sources[$key] = $new_destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $new_sources;
|
return $new_sources;
|
||||||
|
Loading…
Reference in New Issue
Block a user