mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Java: Replace usages of isParameterDefinition.
This commit is contained in:
@@ -47,6 +47,6 @@ predicate defUsePair(VariableUpdate def, VarRead use) {
|
||||
*/
|
||||
predicate parameterDefUsePair(Parameter p, VarRead use) {
|
||||
exists(SsaVariable v |
|
||||
v.getAUse() = use and v.getAnUltimateDefinition().(SsaImplicitInit).isParameterDefinition(p)
|
||||
v.getAUse() = use and v.getAnUltimateDefinition().(SsaParameterInit).getParameter() = p
|
||||
)
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ private predicate varMaybeNull(SsaVariable v, ControlFlowNode node, string msg,
|
||||
or
|
||||
// A parameter might be null if there is a null argument somewhere.
|
||||
exists(Parameter p, Expr arg |
|
||||
v.(SsaImplicitInit).isParameterDefinition(p) and
|
||||
v.(SsaParameterInit).getParameter() = p and
|
||||
node = v.getCfgNode() and
|
||||
p.getAnArgument() = arg and
|
||||
reason = arg and
|
||||
|
||||
@@ -317,6 +317,8 @@ class SsaImplicitInit extends SsaVariable instanceof WriteDefinition {
|
||||
predicate captures(SsaVariable capturedvar) { captures(this, capturedvar) }
|
||||
|
||||
/**
|
||||
* DEPRECATED: Use `SsaParameterInit::getParameter()` instead.
|
||||
*
|
||||
* Holds if the SSA variable is a parameter defined by its initial value in the callable.
|
||||
*/
|
||||
predicate isParameterDefinition(Parameter p) {
|
||||
|
||||
@@ -46,7 +46,7 @@ module SsaFlow {
|
||||
or
|
||||
exists(Parameter p |
|
||||
n = TExplicitParameterNode(p) and
|
||||
result.(Impl::WriteDefSourceNode).getDefinition().(SsaImplicitInit).isParameterDefinition(p)
|
||||
result.(Impl::WriteDefSourceNode).getDefinition().(SsaParameterInit).getParameter() = p
|
||||
)
|
||||
or
|
||||
ssaDefAssigns(result.(Impl::WriteDefSourceNode).getDefinition(), n.asExpr())
|
||||
|
||||
@@ -551,15 +551,15 @@ private class ConstantBooleanArgumentNode extends ArgumentNode, ExprNode {
|
||||
*/
|
||||
predicate isUnreachableInCall(NodeRegion nr, DataFlowCall call) {
|
||||
exists(
|
||||
ExplicitParameterNode paramNode, ConstantBooleanArgumentNode arg, SsaImplicitInit param,
|
||||
ExplicitParameterNode paramNode, ConstantBooleanArgumentNode arg, SsaParameterInit param,
|
||||
Guard guard
|
||||
|
|
||||
// get constant bool argument and parameter for this call
|
||||
viableParamArg(call, pragma[only_bind_into](paramNode), arg) and
|
||||
// get the ssa variable definition for this parameter
|
||||
param.isParameterDefinition(paramNode.getParameter()) and
|
||||
param.getParameter() = paramNode.getParameter() and
|
||||
// which is used in a guard
|
||||
param.getAUse() = guard and
|
||||
param.getARead() = guard and
|
||||
// which controls `n` with the opposite value of `arg`
|
||||
guard
|
||||
.controls(nr,
|
||||
|
||||
@@ -669,7 +669,7 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
|
||||
Expr getARead(Definition def) { result = getAUse(def) }
|
||||
|
||||
predicate ssaDefHasSource(WriteDefinition def) {
|
||||
def instanceof SsaExplicitUpdate or def.(SsaImplicitInit).isParameterDefinition(_)
|
||||
def instanceof SsaExplicitUpdate or def instanceof SsaParameterInit
|
||||
}
|
||||
|
||||
predicate allowFlowIntoUncertainDef(UncertainWriteDefinition def) {
|
||||
|
||||
@@ -273,7 +273,7 @@ private module Impl {
|
||||
}
|
||||
|
||||
/** Holds if the variable underlying the implicit SSA variable `v` is not a field. */
|
||||
predicate nonFieldImplicitSsaDefinition(SsaImplicitInit v) { v.isParameterDefinition(_) }
|
||||
predicate nonFieldImplicitSsaDefinition(SsaParameterInit v) { any() }
|
||||
|
||||
/** Returned an expression that is assigned to `f`. */
|
||||
Expr getAssignedValueToField(Field f) {
|
||||
|
||||
@@ -57,7 +57,7 @@ private class InputStreamWrapperCapturedLocalStep extends AdditionalTaintStep {
|
||||
|
|
||||
n1.asExpr() = captured.(SsaExplicitUpdate).getDefiningExpr().(VariableAssign).getSource()
|
||||
or
|
||||
captured.(SsaImplicitInit).isParameterDefinition(n1.asParameter())
|
||||
captured.(SsaParameterInit).getParameter() = n1.asParameter()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user