mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Deprecate WriteNode.writesComponent
This commit is contained in:
@@ -225,9 +225,11 @@ module ControlFlow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* DEPRECATED: Use the disjunct of `writesElement` and `writesField` instead.
|
||||||
|
*
|
||||||
* Holds if this node sets any field or element of `base` to `rhs`.
|
* Holds if this node sets any field or element of `base` to `rhs`.
|
||||||
*/
|
*/
|
||||||
predicate writesComponent(DataFlow::Node base, DataFlow::Node rhs) {
|
deprecated predicate writesComponent(DataFlow::Node base, DataFlow::Node rhs) {
|
||||||
this.writesElement(base, _, rhs) or this.writesField(base, _, rhs)
|
this.writesElement(base, _, rhs) or this.writesField(base, _, rhs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,13 +141,10 @@ module Protobuf {
|
|||||||
private class WriteMessageFieldStep extends TaintTracking::AdditionalTaintStep {
|
private class WriteMessageFieldStep extends TaintTracking::AdditionalTaintStep {
|
||||||
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
|
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
|
||||||
[succ.getType(), succ.getType().getPointerType()] instanceof MessageType and
|
[succ.getType(), succ.getType().getPointerType()] instanceof MessageType and
|
||||||
exists(DataFlow::Node n, DataFlow::ReadNode base |
|
exists(DataFlow::Write w, DataFlow::ReadNode base |
|
||||||
succ.(DataFlow::PostUpdateNode).getPreUpdateNode() = getUnderlyingNode(base)
|
w.writesElementPreUpdate(base, _, pred) or w.writesFieldPreUpdate(base, _, pred)
|
||||||
|
|
|
|
||||||
any(DataFlow::Write w).writesComponent(n, pred) and
|
succ.(DataFlow::PostUpdateNode).getPreUpdateNode() = getUnderlyingNode(base)
|
||||||
// The below line only works because `base`'s type, `DataFlow::ReadNode`,
|
|
||||||
// is incompatible with `DataFlow::PostUpdateNode`.
|
|
||||||
base = [n, n.(DataFlow::PostUpdateNode).getPreUpdateNode()]
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user