Update UnhandledStreamPipe.ql

Address comments

Co-Authored-By: Asger F <316427+asgerf@users.noreply.github.com>
This commit is contained in:
Napalys Klicius
2025-06-02 19:02:48 +02:00
parent ae74edb033
commit bf2f19da56

View File

@@ -141,11 +141,12 @@ private predicate streamFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
* Tracks the result of a pipe call as it flows through the program.
*/
private DataFlow::SourceNode destinationStreamRef(DataFlow::TypeTracker t, PipeCall pipe) {
t.start() and result = pipe
t.start() and
(result = pipe or result = pipe.getDestinationStream().getALocalSource())
or
exists(DataFlow::SourceNode prev |
prev = destinationStreamRef(t.continue(), pipe) and
streamFlowStep(result.getALocalUse(), prev)
streamFlowStep(prev, result)
)
or
exists(DataFlow::TypeTracker t2 | result = destinationStreamRef(t2, pipe).track(t2, t))