Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 56f6e67

Browse files
committed
Protobufs: improve comment and code style
No functional changes
1 parent 65dc627 commit 56f6e67

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

ql/src/semmle/go/dataflow/SSA.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ private newtype TSsaWithFields =
306306
TStep(SsaWithFields base, Field f) { exists(accessPathAux(base, f)) }
307307

308308
/**
309-
* Gets a representation of `nd` as an ssa-with-fields value if there is one.
309+
* Gets a representation of `insn` as an ssa-with-fields-and-elements value if there is one.
310310
*/
311311
private TSsaWithFields accessPath(IR::Instruction insn) {
312312
exists(SsaVariable v | insn = v.getAUse() | result = TRoot(v))

ql/src/semmle/go/frameworks/Protobuf.qll

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,22 @@ module Protobuf {
4949
}
5050

5151
/**
52-
* Additional taint-flow step modelling flow from MarshalInput.Message to MarshalOutput,
53-
* mediated by a MarshalOptions.MarshalState call.
52+
* Additional taint-flow step modelling flow from `MarshalInput.Message` to `MarshalOutput`,
53+
* mediated by a `MarshalOptions.MarshalState` call.
5454
*
55-
* Note we can taint the whole MarshalOutput as it only has one field (Buf), and taint-
55+
* Note we can taint the whole `MarshalOutput` as it only has one field (`Buf`), and taint-
5656
* tracking always considers a field of a tainted struct to itself be tainted.
5757
*/
5858
private class MarshalStateStep extends TaintTracking::AdditionalTaintStep {
5959
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
60-
exists(
61-
DataFlow::Node marshalInput, DataFlow::Node passedMarshalInput,
62-
DataFlow::CallNode marshalStateCall
63-
|
60+
exists(DataFlow::Node marshalInput, DataFlow::CallNode marshalStateCall |
6461
marshalStateCall = marshalStateMethod().getACall() and
6562
// pred -> marshalInput.Message
6663
any(DataFlow::Write w)
6764
.writesField(marshalInput.(DataFlow::PostUpdateNode).getPreUpdateNode(),
6865
inputMessageField(), pred) and
69-
// marshalInput -> passedMarshalInput
70-
passedMarshalInput.asExpr().getGlobalValueNumber() =
71-
marshalInput.asExpr().getGlobalValueNumber() and
72-
// passedMarshalInput -> marshalStateCall
73-
marshalStateCall.getArgument(0) = passedMarshalInput and
66+
// marshalInput -> marshalStateCall
67+
marshalStateCall.getArgument(0) = globalValueNumber(marshalInput).getANode() and
7468
// marshalStateCall -> succ
7569
marshalStateCall.getResult() = succ
7670
)

0 commit comments

Comments
 (0)