mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Merge pull request #9262 from hvitved/ruby/local-source-node-antijoin
Ruby: Eliminate bad `isLocalSourceNode` antijoin
This commit is contained in:
@@ -298,6 +298,20 @@ private module Cached {
|
||||
)
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private predicate reachedFromExprOrEntrySsaDef(Node n) {
|
||||
localFlowStepTypeTracker(any(Node n0 |
|
||||
n0 instanceof ExprNode
|
||||
or
|
||||
entrySsaDefinition(n0)
|
||||
), n)
|
||||
or
|
||||
exists(Node mid |
|
||||
reachedFromExprOrEntrySsaDef(mid) and
|
||||
localFlowStepTypeTracker(mid, n)
|
||||
)
|
||||
}
|
||||
|
||||
cached
|
||||
predicate isLocalSourceNode(Node n) {
|
||||
n instanceof ParameterNode
|
||||
@@ -305,11 +319,7 @@ private module Cached {
|
||||
n instanceof PostUpdateNodes::ExprPostUpdateNode
|
||||
or
|
||||
// Nodes that can't be reached from another entry definition or expression.
|
||||
not localFlowStepTypeTracker+(any(Node n0 |
|
||||
n0 instanceof ExprNode
|
||||
or
|
||||
entrySsaDefinition(n0)
|
||||
), n)
|
||||
not reachedFromExprOrEntrySsaDef(n)
|
||||
or
|
||||
// Ensure all entry SSA definitions are local sources -- for parameters, this
|
||||
// is needed by type tracking. Note that when the parameter has a default value,
|
||||
|
||||
Reference in New Issue
Block a user