From 79440f6734ac9ab6f66f7556dc0fc4b240c33960 Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Thu, 4 Apr 2024 10:02:02 +0200 Subject: [PATCH] Data flow: Fix bad join ``` Evaluated relational algebra for predicate DataFlowImpl::Impl::storeEx/5#34133ef9@0425e0m7 with tuple counts: 2209132 ~1% {6} r1 = SCAN `DataFlowImpl::Impl::storeExUnrestricted/5#3a86a98e` OUTPUT In.1, In.0, In.1, In.2, In.3, In.4 4338565685 ~1% {6} | JOIN WITH `DataFlowPublic::ContentSet.getAReadContent/0#dispred#e4acf74e_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2, Lhs.3, Lhs.4, Lhs.5 34811200 ~1428% {5} | JOIN WITH `project#DataFlowImpl::Impl::readSetEx/3#35ac556a` ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.3, Lhs.4, Lhs.5 return r1 ``` --- shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll b/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll index 64222dbc8e34..e6ce90089358 100644 --- a/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll +++ b/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll @@ -460,12 +460,15 @@ module MakeImpl Lang> { stepFilter(node1, node2) } + pragma[nomagic] + private predicate hasReadStep(Content c) { read(_, c, _) } + pragma[nomagic] private predicate storeEx( NodeEx node1, Content c, NodeEx node2, DataFlowType contentType, DataFlowType containerType ) { storeExUnrestricted(node1, c, node2, contentType, containerType) and - read(_, c, _) + hasReadStep(c) } pragma[nomagic]