From 74c3fd4ecbef410ef011ae359c9e444b6d8f1505 Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Thu, 31 Aug 2023 13:36:20 +0200 Subject: [PATCH] C#: Implement `multipleArgumentCallExclude` --- csharp/ql/consistency-queries/DataFlowConsistency.ql | 10 ++++++++++ .../code/csharp/dataflow/internal/DataFlowPrivate.qll | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/csharp/ql/consistency-queries/DataFlowConsistency.ql b/csharp/ql/consistency-queries/DataFlowConsistency.ql index 7f0afb47c7526..5a5ffb1b3414f 100644 --- a/csharp/ql/consistency-queries/DataFlowConsistency.ql +++ b/csharp/ql/consistency-queries/DataFlowConsistency.ql @@ -72,6 +72,16 @@ private module Input implements InputSig { } predicate reverseReadExclude(Node n) { n.asExpr() = any(AwaitExpr ae).getExpr() } + + predicate multipleArgumentCallExclude(ArgumentNode arg, DataFlowCall call) { + // exists(ControlFlow::Node cfn | + // exists(arg.asExprAtNode(cfn)) and + // cfn.getASuccessor(any(ControlFlow::SuccessorTypes::ConditionalSuccessor c)) = + // call.getControlFlowNode() + // ) + // TODO: Remove once object initializer nodes are modelled properly + arg.(Private::PostUpdateNodes::ObjectInitializerNode).argumentOf(call, _) + } } import MakeConsistency diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll index 308df381a1213..95475f3b1012b 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll @@ -2026,7 +2026,7 @@ abstract class PostUpdateNode extends Node { abstract Node getPreUpdateNode(); } -private module PostUpdateNodes { +module PostUpdateNodes { class ObjectCreationNode extends PostUpdateNode, ExprNode, TExprNode { private ObjectCreation oc;