From ad6b870f9433aeba311c592aba40926b6d50ca59 Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Thu, 22 Sep 2022 15:01:33 +0200 Subject: [PATCH] Data flow: Sync files --- .../ir/dataflow/internal/DataFlowImplCommon.qll | 3 ++- .../dataflow/internal/DataFlowImplConsistency.qll | 15 +++++++++++++++ .../cpp/dataflow/internal/DataFlowImplCommon.qll | 3 ++- .../dataflow/internal/DataFlowImplConsistency.qll | 15 +++++++++++++++ .../ir/dataflow/internal/DataFlowImplCommon.qll | 3 ++- .../dataflow/internal/DataFlowImplConsistency.qll | 15 +++++++++++++++ .../java/dataflow/internal/DataFlowImplCommon.qll | 3 ++- .../dataflow/internal/DataFlowImplConsistency.qll | 15 +++++++++++++++ .../dataflow/new/internal/DataFlowImplCommon.qll | 3 ++- .../new/internal/DataFlowImplConsistency.qll | 15 +++++++++++++++ .../ruby/dataflow/internal/DataFlowImplCommon.qll | 3 ++- .../dataflow/internal/DataFlowImplConsistency.qll | 15 +++++++++++++++ .../dataflow/internal/DataFlowImplCommon.qll | 3 ++- .../dataflow/internal/DataFlowImplConsistency.qll | 15 +++++++++++++++ 14 files changed, 119 insertions(+), 7 deletions(-) diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll index 95b34f15dad..ae9c6f3f12e 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll +++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll @@ -709,7 +709,8 @@ private module Cached { */ pragma[nomagic] private DataFlowCallable viableImplInCallContextExt(DataFlowCall call, DataFlowCall ctx) { - result = viableImplInCallContext(call, ctx) + result = viableImplInCallContext(call, ctx) and + result = viableCallable(call) or result = viableCallableLambda(call, TDataFlowCallSome(ctx)) or diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll index da828337e56..dde16ab5a2a 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll +++ b/cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll @@ -38,6 +38,13 @@ module Consistency { /** Holds if `n` should be excluded from the consistency test `uniquePostUpdate`. */ predicate uniquePostUpdateExclude(Node n) { none() } + + /** Holds if `(call, ctx)` should be excluded from the consistency test `viableImplInCallContextTooLargeExclude`. */ + predicate viableImplInCallContextTooLargeExclude( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + none() + } } private class RelevantNode extends Node { @@ -217,4 +224,12 @@ module Consistency { not any(ConsistencyConfiguration c).postWithInFlowExclude(n) and msg = "PostUpdateNode should not be the target of local flow." } + + query predicate viableImplInCallContextTooLarge( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + callable = viableImplInCallContext(call, ctx) and + not callable = viableCallable(call) and + not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable) + } } diff --git a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll index 95b34f15dad..ae9c6f3f12e 100644 --- a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll +++ b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll @@ -709,7 +709,8 @@ private module Cached { */ pragma[nomagic] private DataFlowCallable viableImplInCallContextExt(DataFlowCall call, DataFlowCall ctx) { - result = viableImplInCallContext(call, ctx) + result = viableImplInCallContext(call, ctx) and + result = viableCallable(call) or result = viableCallableLambda(call, TDataFlowCallSome(ctx)) or diff --git a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll index da828337e56..dde16ab5a2a 100644 --- a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll +++ b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll @@ -38,6 +38,13 @@ module Consistency { /** Holds if `n` should be excluded from the consistency test `uniquePostUpdate`. */ predicate uniquePostUpdateExclude(Node n) { none() } + + /** Holds if `(call, ctx)` should be excluded from the consistency test `viableImplInCallContextTooLargeExclude`. */ + predicate viableImplInCallContextTooLargeExclude( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + none() + } } private class RelevantNode extends Node { @@ -217,4 +224,12 @@ module Consistency { not any(ConsistencyConfiguration c).postWithInFlowExclude(n) and msg = "PostUpdateNode should not be the target of local flow." } + + query predicate viableImplInCallContextTooLarge( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + callable = viableImplInCallContext(call, ctx) and + not callable = viableCallable(call) and + not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable) + } } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll index 95b34f15dad..ae9c6f3f12e 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll @@ -709,7 +709,8 @@ private module Cached { */ pragma[nomagic] private DataFlowCallable viableImplInCallContextExt(DataFlowCall call, DataFlowCall ctx) { - result = viableImplInCallContext(call, ctx) + result = viableImplInCallContext(call, ctx) and + result = viableCallable(call) or result = viableCallableLambda(call, TDataFlowCallSome(ctx)) or diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll index da828337e56..dde16ab5a2a 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll @@ -38,6 +38,13 @@ module Consistency { /** Holds if `n` should be excluded from the consistency test `uniquePostUpdate`. */ predicate uniquePostUpdateExclude(Node n) { none() } + + /** Holds if `(call, ctx)` should be excluded from the consistency test `viableImplInCallContextTooLargeExclude`. */ + predicate viableImplInCallContextTooLargeExclude( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + none() + } } private class RelevantNode extends Node { @@ -217,4 +224,12 @@ module Consistency { not any(ConsistencyConfiguration c).postWithInFlowExclude(n) and msg = "PostUpdateNode should not be the target of local flow." } + + query predicate viableImplInCallContextTooLarge( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + callable = viableImplInCallContext(call, ctx) and + not callable = viableCallable(call) and + not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable) + } } diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll index 95b34f15dad..ae9c6f3f12e 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll @@ -709,7 +709,8 @@ private module Cached { */ pragma[nomagic] private DataFlowCallable viableImplInCallContextExt(DataFlowCall call, DataFlowCall ctx) { - result = viableImplInCallContext(call, ctx) + result = viableImplInCallContext(call, ctx) and + result = viableCallable(call) or result = viableCallableLambda(call, TDataFlowCallSome(ctx)) or diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll index da828337e56..dde16ab5a2a 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll @@ -38,6 +38,13 @@ module Consistency { /** Holds if `n` should be excluded from the consistency test `uniquePostUpdate`. */ predicate uniquePostUpdateExclude(Node n) { none() } + + /** Holds if `(call, ctx)` should be excluded from the consistency test `viableImplInCallContextTooLargeExclude`. */ + predicate viableImplInCallContextTooLargeExclude( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + none() + } } private class RelevantNode extends Node { @@ -217,4 +224,12 @@ module Consistency { not any(ConsistencyConfiguration c).postWithInFlowExclude(n) and msg = "PostUpdateNode should not be the target of local flow." } + + query predicate viableImplInCallContextTooLarge( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + callable = viableImplInCallContext(call, ctx) and + not callable = viableCallable(call) and + not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable) + } } diff --git a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll index 95b34f15dad..ae9c6f3f12e 100644 --- a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll +++ b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll @@ -709,7 +709,8 @@ private module Cached { */ pragma[nomagic] private DataFlowCallable viableImplInCallContextExt(DataFlowCall call, DataFlowCall ctx) { - result = viableImplInCallContext(call, ctx) + result = viableImplInCallContext(call, ctx) and + result = viableCallable(call) or result = viableCallableLambda(call, TDataFlowCallSome(ctx)) or diff --git a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll index da828337e56..dde16ab5a2a 100644 --- a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll +++ b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll @@ -38,6 +38,13 @@ module Consistency { /** Holds if `n` should be excluded from the consistency test `uniquePostUpdate`. */ predicate uniquePostUpdateExclude(Node n) { none() } + + /** Holds if `(call, ctx)` should be excluded from the consistency test `viableImplInCallContextTooLargeExclude`. */ + predicate viableImplInCallContextTooLargeExclude( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + none() + } } private class RelevantNode extends Node { @@ -217,4 +224,12 @@ module Consistency { not any(ConsistencyConfiguration c).postWithInFlowExclude(n) and msg = "PostUpdateNode should not be the target of local flow." } + + query predicate viableImplInCallContextTooLarge( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + callable = viableImplInCallContext(call, ctx) and + not callable = viableCallable(call) and + not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable) + } } diff --git a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll index 95b34f15dad..ae9c6f3f12e 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll @@ -709,7 +709,8 @@ private module Cached { */ pragma[nomagic] private DataFlowCallable viableImplInCallContextExt(DataFlowCall call, DataFlowCall ctx) { - result = viableImplInCallContext(call, ctx) + result = viableImplInCallContext(call, ctx) and + result = viableCallable(call) or result = viableCallableLambda(call, TDataFlowCallSome(ctx)) or diff --git a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll index da828337e56..dde16ab5a2a 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll @@ -38,6 +38,13 @@ module Consistency { /** Holds if `n` should be excluded from the consistency test `uniquePostUpdate`. */ predicate uniquePostUpdateExclude(Node n) { none() } + + /** Holds if `(call, ctx)` should be excluded from the consistency test `viableImplInCallContextTooLargeExclude`. */ + predicate viableImplInCallContextTooLargeExclude( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + none() + } } private class RelevantNode extends Node { @@ -217,4 +224,12 @@ module Consistency { not any(ConsistencyConfiguration c).postWithInFlowExclude(n) and msg = "PostUpdateNode should not be the target of local flow." } + + query predicate viableImplInCallContextTooLarge( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + callable = viableImplInCallContext(call, ctx) and + not callable = viableCallable(call) and + not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable) + } } diff --git a/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplCommon.qll b/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplCommon.qll index 95b34f15dad..ae9c6f3f12e 100644 --- a/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplCommon.qll +++ b/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplCommon.qll @@ -709,7 +709,8 @@ private module Cached { */ pragma[nomagic] private DataFlowCallable viableImplInCallContextExt(DataFlowCall call, DataFlowCall ctx) { - result = viableImplInCallContext(call, ctx) + result = viableImplInCallContext(call, ctx) and + result = viableCallable(call) or result = viableCallableLambda(call, TDataFlowCallSome(ctx)) or diff --git a/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll b/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll index da828337e56..dde16ab5a2a 100644 --- a/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll +++ b/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll @@ -38,6 +38,13 @@ module Consistency { /** Holds if `n` should be excluded from the consistency test `uniquePostUpdate`. */ predicate uniquePostUpdateExclude(Node n) { none() } + + /** Holds if `(call, ctx)` should be excluded from the consistency test `viableImplInCallContextTooLargeExclude`. */ + predicate viableImplInCallContextTooLargeExclude( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + none() + } } private class RelevantNode extends Node { @@ -217,4 +224,12 @@ module Consistency { not any(ConsistencyConfiguration c).postWithInFlowExclude(n) and msg = "PostUpdateNode should not be the target of local flow." } + + query predicate viableImplInCallContextTooLarge( + DataFlowCall call, DataFlowCall ctx, DataFlowCallable callable + ) { + callable = viableImplInCallContext(call, ctx) and + not callable = viableCallable(call) and + not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable) + } }