From 9b38028e25ea3f8e2165e9d16bdfb4f5eff48f0e Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Thu, 10 Aug 2023 15:31:04 +0200 Subject: [PATCH] Data flow: Fix `localWriteStep` consistency query --- shared/dataflow/codeql/dataflow/VariableCapture.qll | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shared/dataflow/codeql/dataflow/VariableCapture.qll b/shared/dataflow/codeql/dataflow/VariableCapture.qll index a1504d44fdc..8cee2b4c042 100644 --- a/shared/dataflow/codeql/dataflow/VariableCapture.qll +++ b/shared/dataflow/codeql/dataflow/VariableCapture.qll @@ -371,9 +371,10 @@ module Flow implements OutputSig { query predicate uniqueWriteCfgNode(string msg) { uniqueWriteCfgNode(_, msg) } private predicate localWriteStep(VariableWrite vw, string msg) { - exists(BasicBlock bb | - vw.hasCfgNode(bb, _) and - bb.getEnclosingCallable() != vw.getVariable().getCallable() and + exists(BasicBlock bb1, BasicBlock bb2 | + vw.hasCfgNode(bb1, _) and + vw.getSource().hasCfgNode(bb2, _) and + bb1.getEnclosingCallable() != bb2.getEnclosingCallable() and msg = "VariableWrite is not a local step" ) }