mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
Data flow: Fix inconsistencies
This commit is contained in:
@@ -122,7 +122,14 @@ private module Cached {
|
||||
TNormalParameterNode(Parameter p) { not p instanceof BlockParameter } or
|
||||
TSelfParameterNode(MethodBase m) or
|
||||
TBlockParameterNode(MethodBase m) or
|
||||
TExprPostUpdateNode(CfgNodes::ExprCfgNode n) { n.getNode() instanceof Argument }
|
||||
TExprPostUpdateNode(CfgNodes::ExprCfgNode n) {
|
||||
exists(AstNode node | node = n.getNode() |
|
||||
node instanceof Argument and
|
||||
not node instanceof BlockArgument
|
||||
or
|
||||
n = any(CfgNodes::ExprNodes::CallCfgNode call).getReceiver()
|
||||
)
|
||||
}
|
||||
|
||||
class TParameterNode = TNormalParameterNode or TBlockParameterNode or TSelfParameterNode;
|
||||
|
||||
@@ -142,7 +149,7 @@ private module Cached {
|
||||
nodeTo.(ParameterNode).getParameter().(KeywordParameter).getDefaultValue() =
|
||||
nodeFrom.asExpr().getExpr()
|
||||
or
|
||||
nodeFrom.(SelfParameterNode).getMethod() = nodeTo.asExpr().getExpr().getEnclosingMethod() and
|
||||
nodeFrom.(SelfParameterNode).getMethod() = nodeTo.asExpr().getExpr().getEnclosingCallable() and
|
||||
nodeTo.asExpr().getExpr() instanceof Self
|
||||
or
|
||||
nodeFrom.asExpr() = nodeTo.asExpr().(CfgNodes::ExprNodes::AssignExprCfgNode).getRhs()
|
||||
@@ -446,6 +453,13 @@ predicate jumpStep(Node pred, Node succ) {
|
||||
or
|
||||
SsaImpl::captureFlowOut(pred.(SsaDefinitionNode).getDefinition(),
|
||||
succ.(SsaDefinitionNode).getDefinition())
|
||||
or
|
||||
exists(Self s, Method m |
|
||||
s = succ.asExpr().getExpr() and
|
||||
pred.(SelfParameterNode).getMethod() = m and
|
||||
m = s.getEnclosingMethod() and
|
||||
m != s.getEnclosingCallable()
|
||||
)
|
||||
}
|
||||
|
||||
predicate storeStep(Node node1, Content c, Node node2) { none() }
|
||||
@@ -537,7 +551,7 @@ class Unit extends TUnit {
|
||||
*
|
||||
* This predicate is only used for consistency checks.
|
||||
*/
|
||||
predicate isImmutableOrUnobservable(Node n) { none() }
|
||||
predicate isImmutableOrUnobservable(Node n) { n instanceof BlockArgumentNode }
|
||||
|
||||
/**
|
||||
* Holds if the node `n` is unreachable when the call context is `call`.
|
||||
|
||||
Reference in New Issue
Block a user