mirror of
https://github.com/github/codeql.git
synced 2026-04-22 07:15:15 +02:00
Ensure pattern-case and binding-instanceof are covered in all of type, dispatch and object flow
This commit is contained in:
@@ -116,6 +116,22 @@ private predicate step(TypeFlowNode n1, TypeFlowNode n2) {
|
||||
n2.asSsa().(BaseSsaUpdate).getDefiningExpr().(VariableAssign).getSource() = n1.asExpr()
|
||||
or
|
||||
n2.asSsa().(BaseSsaImplicitInit).captures(n1.asSsa())
|
||||
or
|
||||
exists(PatternCase pc, LocalVariableDeclExpr patternVar |
|
||||
patternVar = pc.getPattern().asBindingPattern() and
|
||||
n2.asSsa().(BaseSsaUpdate).getDefiningExpr() = patternVar and
|
||||
(
|
||||
pc.getSwitch().getExpr() = n1.asExpr()
|
||||
or
|
||||
pc.getSwitchExpr().getExpr() = n1.asExpr()
|
||||
)
|
||||
)
|
||||
or
|
||||
exists(InstanceOfExpr ioe, LocalVariableDeclExpr patternVar |
|
||||
patternVar = ioe.getPattern().asBindingPattern() and
|
||||
n2.asSsa().(BaseSsaUpdate).getDefiningExpr() = patternVar and
|
||||
ioe.getExpr() = n1.asExpr()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -167,6 +167,20 @@ private module TypeTrackingSteps {
|
||||
def.(BaseSsaUpdate).getDefiningExpr().(VariableAssign).getSource() = n1.asExpr()
|
||||
or
|
||||
def.(BaseSsaImplicitInit).isParameterDefinition(n1.asParameter())
|
||||
or
|
||||
exists(PatternCase pc |
|
||||
pc.getPattern().asBindingPattern() = def.(BaseSsaUpdate).getDefiningExpr() and
|
||||
(
|
||||
pc.getSwitch().getExpr() = n1.asExpr()
|
||||
or
|
||||
pc.getSwitchExpr().getExpr() = n1.asExpr()
|
||||
)
|
||||
)
|
||||
or
|
||||
exists(InstanceOfExpr ioe |
|
||||
ioe.getPattern().asBindingPattern() = def.(BaseSsaUpdate).getDefiningExpr() and
|
||||
ioe.getExpr() = n1.asExpr()
|
||||
)
|
||||
|
|
||||
v.getAnUltimateDefinition() = def and
|
||||
v.getAUse() = n2.asExpr()
|
||||
|
||||
@@ -89,6 +89,11 @@ private predicate step(Node n1, Node n2) {
|
||||
pc.getSwitchExpr().getExpr() = n1.asExpr()
|
||||
)
|
||||
)
|
||||
or
|
||||
exists(InstanceOfExpr ioe |
|
||||
ioe.getPattern().asBindingPattern() = def.(BaseSsaUpdate).getDefiningExpr() and
|
||||
ioe.getExpr() = n1.asExpr()
|
||||
)
|
||||
|
|
||||
v.getAnUltimateDefinition() = def and
|
||||
v.getAUse() = n2.asExpr()
|
||||
|
||||
Reference in New Issue
Block a user