Deprecate WriteNode.writesComponent

This commit is contained in:
Owen Mansel-Chan
2025-09-29 17:22:01 +01:00
parent 59e3c14a5e
commit 8a21a4ff92
2 changed files with 6 additions and 7 deletions

View File

@@ -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)
} }

View File

@@ -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()]
) )
} }
} }