Skip to content

Commit 36ea61c

Browse files
committed
C#: Address review comments.
1 parent 8517f11 commit 36ea61c

File tree

4 files changed

+10
-414
lines changed

4 files changed

+10
-414
lines changed

config/identical-files.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll",
4141
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll",
4242
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll",
43-
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplForContentDataFlow.qll",
4443
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl1.qll",
4544
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl2.qll",
4645
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImplForStringsNewReplacer.qll",

csharp/ql/lib/semmle/code/csharp/dataflow/internal/ContentDataFlow.qll

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
*/
2525

2626
private import csharp
27+
private import codeql.util.Boolean
2728
private import DataFlowImplCommon
2829
private import DataFlowImplSpecific::Private
2930
private import DataFlowImplSpecific::Private as DataFlowPrivate
3031

3132
/**
3233
* An input configuration for content data flow.
3334
*/
34-
signature module ContentConfigSig {
35+
signature module ConfigSig {
3536
/**
3637
* Holds if `source` is a relevant data flow source.
3738
*/
@@ -76,7 +77,7 @@ signature module ContentConfigSig {
7677
/**
7778
* Constructs a global content data flow computation.
7879
*/
79-
module Global<ContentConfigSig ContentConfig> implements DataFlow::GlobalFlowSig {
80+
module Global<ConfigSig ContentConfig> {
8081
private module FlowConfig implements DataFlow::StateConfigSig {
8182
class FlowState = State;
8283

@@ -116,8 +117,6 @@ module Global<ContentConfigSig ContentConfig> implements DataFlow::GlobalFlowSig
116117

117118
private module Flow = DataFlow::GlobalWithState<FlowConfig>;
118119

119-
import Flow
120-
121120
/**
122121
* Holds if data stored inside `sourceAp` on `source` flows to `sinkAp` inside `sink`
123122
* for this configuration. `preservesValue` indicates whether any of the additional
@@ -131,7 +130,7 @@ module Global<ContentConfigSig ContentConfig> implements DataFlow::GlobalFlowSig
131130
* that was last stored into. That is, if `sinkAp` is `Field1.Field2` (with `Field1`
132131
* being the top of the stack), then there is flow into `sink.Field1.Field2`.
133132
*/
134-
additional predicate flow(
133+
predicate flow(
135134
DataFlow::Node source, AccessPath sourceAp, DataFlow::Node sink, AccessPath sinkAp,
136135
boolean preservesValue
137136
) {
@@ -150,15 +149,11 @@ module Global<ContentConfigSig ContentConfig> implements DataFlow::GlobalFlowSig
150149
}
151150

152151
private newtype TState =
153-
TInitState(boolean preservesValue) { preservesValue in [false, true] } or
154-
TStoreState(int size, boolean preservesValue) {
155-
size in [1 .. ContentConfig::accessPathLimit()] and
156-
preservesValue in [false, true]
152+
TInitState(Boolean preservesValue) or
153+
TStoreState(int size, Boolean preservesValue) {
154+
size in [1 .. ContentConfig::accessPathLimit()]
157155
} or
158-
TReadState(int size, boolean preservesValue) {
159-
size in [1 .. ContentConfig::accessPathLimit()] and
160-
preservesValue in [false, true]
161-
}
156+
TReadState(int size, Boolean preservesValue) { size in [1 .. ContentConfig::accessPathLimit()] }
162157

163158
abstract private class State extends TState {
164159
abstract string toString();
@@ -260,7 +255,7 @@ module Global<ContentConfigSig ContentConfig> implements DataFlow::GlobalFlowSig
260255
}
261256

262257
/** An access path. */
263-
additional class AccessPath extends TAccessPath {
258+
class AccessPath extends TAccessPath {
264259
/** Gets the head of this access path, if any. */
265260
DataFlow::ContentSet getHead() { this = TAccessPathCons(result, _) }
266261

0 commit comments

Comments
 (0)