From e506f638fcb66a26d96850d98cd43e37ae344e20 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Thu, 27 Apr 2023 18:40:33 +0100 Subject: [PATCH] DataFlow: Sync identical files. --- .../cpp/dataflow/internal/DataFlowImplConsistency.qll | 9 +++++++++ .../csharp/dataflow/internal/DataFlowImplConsistency.qll | 9 +++++++++ .../java/dataflow/internal/DataFlowImplConsistency.qll | 9 +++++++++ .../dataflow/new/internal/DataFlowImplConsistency.qll | 9 +++++++++ .../ruby/dataflow/internal/DataFlowImplConsistency.qll | 9 +++++++++ .../swift/dataflow/internal/DataFlowImplConsistency.qll | 9 +++++++++ 6 files changed, 54 insertions(+) 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 7da63f6c4fa..e154491f795 100644 --- a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll +++ b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll @@ -58,6 +58,9 @@ module Consistency { predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) { none() } + + /** Holds if `n` should be excluded from the consistency test `identityLocalStep`. */ + predicate identityLocalStepExclude(Node n) { none() } } private class RelevantNode extends Node { @@ -287,4 +290,10 @@ module Consistency { not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and msg = "Non-unique content approximation." } + + query predicate identityLocalStep(Node n, string msg) { + simpleLocalFlowStep(n, n) and + not any(ConsistencyConfiguration c).identityLocalStepExclude(n) and + msg = "Node steps to itself" + } } diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll index 7da63f6c4fa..e154491f795 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll @@ -58,6 +58,9 @@ module Consistency { predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) { none() } + + /** Holds if `n` should be excluded from the consistency test `identityLocalStep`. */ + predicate identityLocalStepExclude(Node n) { none() } } private class RelevantNode extends Node { @@ -287,4 +290,10 @@ module Consistency { not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and msg = "Non-unique content approximation." } + + query predicate identityLocalStep(Node n, string msg) { + simpleLocalFlowStep(n, n) and + not any(ConsistencyConfiguration c).identityLocalStepExclude(n) and + msg = "Node steps to itself" + } } 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 7da63f6c4fa..e154491f795 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll @@ -58,6 +58,9 @@ module Consistency { predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) { none() } + + /** Holds if `n` should be excluded from the consistency test `identityLocalStep`. */ + predicate identityLocalStepExclude(Node n) { none() } } private class RelevantNode extends Node { @@ -287,4 +290,10 @@ module Consistency { not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and msg = "Non-unique content approximation." } + + query predicate identityLocalStep(Node n, string msg) { + simpleLocalFlowStep(n, n) and + not any(ConsistencyConfiguration c).identityLocalStepExclude(n) and + msg = "Node steps to itself" + } } 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 7da63f6c4fa..e154491f795 100644 --- a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll +++ b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll @@ -58,6 +58,9 @@ module Consistency { predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) { none() } + + /** Holds if `n` should be excluded from the consistency test `identityLocalStep`. */ + predicate identityLocalStepExclude(Node n) { none() } } private class RelevantNode extends Node { @@ -287,4 +290,10 @@ module Consistency { not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and msg = "Non-unique content approximation." } + + query predicate identityLocalStep(Node n, string msg) { + simpleLocalFlowStep(n, n) and + not any(ConsistencyConfiguration c).identityLocalStepExclude(n) and + msg = "Node steps to itself" + } } diff --git a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll index 7da63f6c4fa..e154491f795 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll @@ -58,6 +58,9 @@ module Consistency { predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) { none() } + + /** Holds if `n` should be excluded from the consistency test `identityLocalStep`. */ + predicate identityLocalStepExclude(Node n) { none() } } private class RelevantNode extends Node { @@ -287,4 +290,10 @@ module Consistency { not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and msg = "Non-unique content approximation." } + + query predicate identityLocalStep(Node n, string msg) { + simpleLocalFlowStep(n, n) and + not any(ConsistencyConfiguration c).identityLocalStepExclude(n) and + msg = "Node steps to itself" + } } diff --git a/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll b/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll index 7da63f6c4fa..e154491f795 100644 --- a/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll +++ b/swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll @@ -58,6 +58,9 @@ module Consistency { predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) { none() } + + /** Holds if `n` should be excluded from the consistency test `identityLocalStep`. */ + predicate identityLocalStepExclude(Node n) { none() } } private class RelevantNode extends Node { @@ -287,4 +290,10 @@ module Consistency { not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and msg = "Non-unique content approximation." } + + query predicate identityLocalStep(Node n, string msg) { + simpleLocalFlowStep(n, n) and + not any(ConsistencyConfiguration c).identityLocalStepExclude(n) and + msg = "Node steps to itself" + } }