From 6c6b6061bc52f8c5198078b285a052f995e5454f Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Thu, 3 Oct 2024 11:45:41 +0200 Subject: [PATCH] Dataflow: Add consistency check. --- .../dataflow/internal/DataFlowImplConsistency.qll | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shared/dataflow/codeql/dataflow/internal/DataFlowImplConsistency.qll b/shared/dataflow/codeql/dataflow/internal/DataFlowImplConsistency.qll index 48c4d42daaa..ca523e179c4 100644 --- a/shared/dataflow/codeql/dataflow/internal/DataFlowImplConsistency.qll +++ b/shared/dataflow/codeql/dataflow/internal/DataFlowImplConsistency.qll @@ -323,4 +323,18 @@ module MakeConsistency< lambdaCall(call, _, receiver) and not nodeGetEnclosingCallable(receiver) = call.getEnclosingCallable() } + + query predicate speculativeStepAlreadyHasModel(Node n1, Node n2, string model) { + speculativeTaintStep(n1, n2) and + not defaultAdditionalTaintStep(n1, n2, _) and + ( + simpleLocalFlowStep(n1, n2, _) and model = "SimpleLocalFlowStep" + or + exists(DataFlowCall call | + exists(viableCallable(call)) and + isArgumentNode(n1, call, _) and + model = "dispatch" + ) + ) + } }