mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
Data flow: Support stores into nodes that are not PostUpdateNodes
This commit is contained in:
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -415,8 +415,7 @@ class CastingNode extends Node {
|
|||||||
CastingNode() {
|
CastingNode() {
|
||||||
this instanceof ParameterNode or
|
this instanceof ParameterNode or
|
||||||
this instanceof CastNode or
|
this instanceof CastNode or
|
||||||
this instanceof OutNode or
|
this instanceof OutNodeExt
|
||||||
this.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNode
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,6 +563,18 @@ class ReturnNodeExt extends Node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A node to which data can flow from a call. Either an ordinary out node
|
||||||
|
* or a post-update node associated with a call argument.
|
||||||
|
*/
|
||||||
|
class OutNodeExt extends Node {
|
||||||
|
OutNodeExt() {
|
||||||
|
this instanceof OutNode
|
||||||
|
or
|
||||||
|
this.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extended return kind. A return kind describes how data can be returned
|
* An extended return kind. A return kind describes how data can be returned
|
||||||
* from a callable. This can either be through a returned value or an updated
|
* from a callable. This can either be through a returned value or an updated
|
||||||
@@ -574,7 +585,7 @@ abstract class ReturnKindExt extends TReturnKindExt {
|
|||||||
abstract string toString();
|
abstract string toString();
|
||||||
|
|
||||||
/** Gets a node corresponding to data flow out of `call`. */
|
/** Gets a node corresponding to data flow out of `call`. */
|
||||||
abstract Node getAnOutNode(DataFlowCall call);
|
abstract OutNodeExt getAnOutNode(DataFlowCall call);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
||||||
@@ -586,7 +597,9 @@ class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
|||||||
|
|
||||||
override string toString() { result = kind.toString() }
|
override string toString() { result = kind.toString() }
|
||||||
|
|
||||||
override Node getAnOutNode(DataFlowCall call) { result = getAnOutNode(call, this.getKind()) }
|
override OutNodeExt getAnOutNode(DataFlowCall call) {
|
||||||
|
result = getAnOutNode(call, this.getKind())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
||||||
@@ -598,9 +611,9 @@ class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
|||||||
|
|
||||||
override string toString() { result = "param update " + pos }
|
override string toString() { result = "param update " + pos }
|
||||||
|
|
||||||
override PostUpdateNode getAnOutNode(DataFlowCall call) {
|
override OutNodeExt getAnOutNode(DataFlowCall call) {
|
||||||
exists(ArgumentNode arg |
|
exists(ArgumentNode arg |
|
||||||
result.getPreUpdateNode() = arg and
|
result.(PostUpdateNode).getPreUpdateNode() = arg and
|
||||||
arg.argumentOf(call, this.getPosition())
|
arg.argumentOf(call, this.getPosition())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -415,8 +415,7 @@ class CastingNode extends Node {
|
|||||||
CastingNode() {
|
CastingNode() {
|
||||||
this instanceof ParameterNode or
|
this instanceof ParameterNode or
|
||||||
this instanceof CastNode or
|
this instanceof CastNode or
|
||||||
this instanceof OutNode or
|
this instanceof OutNodeExt
|
||||||
this.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNode
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,6 +563,18 @@ class ReturnNodeExt extends Node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A node to which data can flow from a call. Either an ordinary out node
|
||||||
|
* or a post-update node associated with a call argument.
|
||||||
|
*/
|
||||||
|
class OutNodeExt extends Node {
|
||||||
|
OutNodeExt() {
|
||||||
|
this instanceof OutNode
|
||||||
|
or
|
||||||
|
this.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extended return kind. A return kind describes how data can be returned
|
* An extended return kind. A return kind describes how data can be returned
|
||||||
* from a callable. This can either be through a returned value or an updated
|
* from a callable. This can either be through a returned value or an updated
|
||||||
@@ -574,7 +585,7 @@ abstract class ReturnKindExt extends TReturnKindExt {
|
|||||||
abstract string toString();
|
abstract string toString();
|
||||||
|
|
||||||
/** Gets a node corresponding to data flow out of `call`. */
|
/** Gets a node corresponding to data flow out of `call`. */
|
||||||
abstract Node getAnOutNode(DataFlowCall call);
|
abstract OutNodeExt getAnOutNode(DataFlowCall call);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
||||||
@@ -586,7 +597,9 @@ class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
|||||||
|
|
||||||
override string toString() { result = kind.toString() }
|
override string toString() { result = kind.toString() }
|
||||||
|
|
||||||
override Node getAnOutNode(DataFlowCall call) { result = getAnOutNode(call, this.getKind()) }
|
override OutNodeExt getAnOutNode(DataFlowCall call) {
|
||||||
|
result = getAnOutNode(call, this.getKind())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
||||||
@@ -598,9 +611,9 @@ class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
|||||||
|
|
||||||
override string toString() { result = "param update " + pos }
|
override string toString() { result = "param update " + pos }
|
||||||
|
|
||||||
override PostUpdateNode getAnOutNode(DataFlowCall call) {
|
override OutNodeExt getAnOutNode(DataFlowCall call) {
|
||||||
exists(ArgumentNode arg |
|
exists(ArgumentNode arg |
|
||||||
result.getPreUpdateNode() = arg and
|
result.(PostUpdateNode).getPreUpdateNode() = arg and
|
||||||
arg.argumentOf(call, this.getPosition())
|
arg.argumentOf(call, this.getPosition())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -415,8 +415,7 @@ class CastingNode extends Node {
|
|||||||
CastingNode() {
|
CastingNode() {
|
||||||
this instanceof ParameterNode or
|
this instanceof ParameterNode or
|
||||||
this instanceof CastNode or
|
this instanceof CastNode or
|
||||||
this instanceof OutNode or
|
this instanceof OutNodeExt
|
||||||
this.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNode
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,6 +563,18 @@ class ReturnNodeExt extends Node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A node to which data can flow from a call. Either an ordinary out node
|
||||||
|
* or a post-update node associated with a call argument.
|
||||||
|
*/
|
||||||
|
class OutNodeExt extends Node {
|
||||||
|
OutNodeExt() {
|
||||||
|
this instanceof OutNode
|
||||||
|
or
|
||||||
|
this.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extended return kind. A return kind describes how data can be returned
|
* An extended return kind. A return kind describes how data can be returned
|
||||||
* from a callable. This can either be through a returned value or an updated
|
* from a callable. This can either be through a returned value or an updated
|
||||||
@@ -574,7 +585,7 @@ abstract class ReturnKindExt extends TReturnKindExt {
|
|||||||
abstract string toString();
|
abstract string toString();
|
||||||
|
|
||||||
/** Gets a node corresponding to data flow out of `call`. */
|
/** Gets a node corresponding to data flow out of `call`. */
|
||||||
abstract Node getAnOutNode(DataFlowCall call);
|
abstract OutNodeExt getAnOutNode(DataFlowCall call);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
||||||
@@ -586,7 +597,9 @@ class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
|||||||
|
|
||||||
override string toString() { result = kind.toString() }
|
override string toString() { result = kind.toString() }
|
||||||
|
|
||||||
override Node getAnOutNode(DataFlowCall call) { result = getAnOutNode(call, this.getKind()) }
|
override OutNodeExt getAnOutNode(DataFlowCall call) {
|
||||||
|
result = getAnOutNode(call, this.getKind())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
||||||
@@ -598,9 +611,9 @@ class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
|||||||
|
|
||||||
override string toString() { result = "param update " + pos }
|
override string toString() { result = "param update " + pos }
|
||||||
|
|
||||||
override PostUpdateNode getAnOutNode(DataFlowCall call) {
|
override OutNodeExt getAnOutNode(DataFlowCall call) {
|
||||||
exists(ArgumentNode arg |
|
exists(ArgumentNode arg |
|
||||||
result.getPreUpdateNode() = arg and
|
result.(PostUpdateNode).getPreUpdateNode() = arg and
|
||||||
arg.argumentOf(call, this.getPosition())
|
arg.argumentOf(call, this.getPosition())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1060,8 +1060,8 @@ private module LocalFlowBigStep {
|
|||||||
jumpStep(_, node, config) or
|
jumpStep(_, node, config) or
|
||||||
additionalJumpStep(_, node, config) or
|
additionalJumpStep(_, node, config) or
|
||||||
node instanceof ParameterNode or
|
node instanceof ParameterNode or
|
||||||
node instanceof OutNode or
|
node instanceof OutNodeExt or
|
||||||
node instanceof PostUpdateNode or
|
store(_, _, node) or
|
||||||
read(_, _, node) or
|
read(_, _, node) or
|
||||||
node instanceof CastNode
|
node instanceof CastNode
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -415,8 +415,7 @@ class CastingNode extends Node {
|
|||||||
CastingNode() {
|
CastingNode() {
|
||||||
this instanceof ParameterNode or
|
this instanceof ParameterNode or
|
||||||
this instanceof CastNode or
|
this instanceof CastNode or
|
||||||
this instanceof OutNode or
|
this instanceof OutNodeExt
|
||||||
this.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNode
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,6 +563,18 @@ class ReturnNodeExt extends Node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A node to which data can flow from a call. Either an ordinary out node
|
||||||
|
* or a post-update node associated with a call argument.
|
||||||
|
*/
|
||||||
|
class OutNodeExt extends Node {
|
||||||
|
OutNodeExt() {
|
||||||
|
this instanceof OutNode
|
||||||
|
or
|
||||||
|
this.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extended return kind. A return kind describes how data can be returned
|
* An extended return kind. A return kind describes how data can be returned
|
||||||
* from a callable. This can either be through a returned value or an updated
|
* from a callable. This can either be through a returned value or an updated
|
||||||
@@ -574,7 +585,7 @@ abstract class ReturnKindExt extends TReturnKindExt {
|
|||||||
abstract string toString();
|
abstract string toString();
|
||||||
|
|
||||||
/** Gets a node corresponding to data flow out of `call`. */
|
/** Gets a node corresponding to data flow out of `call`. */
|
||||||
abstract Node getAnOutNode(DataFlowCall call);
|
abstract OutNodeExt getAnOutNode(DataFlowCall call);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
||||||
@@ -586,7 +597,9 @@ class ValueReturnKind extends ReturnKindExt, TValueReturn {
|
|||||||
|
|
||||||
override string toString() { result = kind.toString() }
|
override string toString() { result = kind.toString() }
|
||||||
|
|
||||||
override Node getAnOutNode(DataFlowCall call) { result = getAnOutNode(call, this.getKind()) }
|
override OutNodeExt getAnOutNode(DataFlowCall call) {
|
||||||
|
result = getAnOutNode(call, this.getKind())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
||||||
@@ -598,9 +611,9 @@ class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
|
|||||||
|
|
||||||
override string toString() { result = "param update " + pos }
|
override string toString() { result = "param update " + pos }
|
||||||
|
|
||||||
override PostUpdateNode getAnOutNode(DataFlowCall call) {
|
override OutNodeExt getAnOutNode(DataFlowCall call) {
|
||||||
exists(ArgumentNode arg |
|
exists(ArgumentNode arg |
|
||||||
result.getPreUpdateNode() = arg and
|
result.(PostUpdateNode).getPreUpdateNode() = arg and
|
||||||
arg.argumentOf(call, this.getPosition())
|
arg.argumentOf(call, this.getPosition())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user