diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplSpecific.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplSpecific.qll index d548c0ef276..ab1e75b3d0f 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplSpecific.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplSpecific.qll @@ -30,5 +30,7 @@ module CsharpDataFlow implements InputSig { exists(n.(AssignableDefinitionNode).getDefinition().getTargetAccess()) } - DataFlowType getSourceContextParameterNodeType() { result.isSourceContextParameterType() } + DataFlowType getSourceContextParameterNodeType(Node p) { + exists(p) and result.isSourceContextParameterType() + } } 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 64a869e346e..9a550a30b73 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll @@ -2526,6 +2526,8 @@ predicate typeStrongerThan(DataFlowType t1, DataFlowType t2) { uselessTypebound(t2) or compatibleTypesDelegateLeft(t1, t2) + or + compatibleTypesSourceContextParameterTypeLeft(t1, t2) } /** diff --git a/shared/dataflow/codeql/dataflow/DataFlow.qll b/shared/dataflow/codeql/dataflow/DataFlow.qll index bc9fc26adb1..cacd52cf839 100644 --- a/shared/dataflow/codeql/dataflow/DataFlow.qll +++ b/shared/dataflow/codeql/dataflow/DataFlow.qll @@ -64,7 +64,7 @@ signature module InputSig { DataFlowType getNodeType(Node node); /** - * Gets a special type to use for parameter nodes belonging to callables with a + * Gets a special type to use for parameter node `p` belonging to callables with a * source node where a source call context `FlowFeature` is used, if any. * * This can be used to prevent lambdas from being resolved, when a concrete call @@ -90,7 +90,7 @@ signature module InputSig { * prevent the call edge from (1) to (4). Note that the call edge from (3) to (2) * will still be valid. */ - default DataFlowType getSourceContextParameterNodeType() { none() } + default DataFlowType getSourceContextParameterNodeType(Node p) { none() } predicate nodeIsHidden(Node node); diff --git a/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll b/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll index 3a414b8a000..b2d4d13b07d 100644 --- a/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll +++ b/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll @@ -2117,8 +2117,8 @@ module MakeImplCommon Lang> { private predicate typeFlowParamType(ParamNode p, Type t, boolean cc) { exists(Callable c | Input::dataFlowNonCallEntry(c, cc) and - if cc = true and exists(getSourceContextParameterNodeType()) - then t = getSourceContextParameterNodeType() + if cc = true and exists(getSourceContextParameterNodeType(p)) + then t = getSourceContextParameterNodeType(p) else trackedParamWithType(p, t, c) ) or