@@ -12,8 +12,8 @@ private module Cached {
12
12
LevelStep ( ) or
13
13
CallStep ( ) or
14
14
ReturnStep ( ) or
15
- StoreStep ( TypeTrackerContentSet contents ) or
16
- LoadStep ( TypeTrackerContentSet contents ) or
15
+ StoreStep ( TypeTrackerContent content ) or
16
+ LoadStep ( TypeTrackerContent content ) or
17
17
JumpStep ( )
18
18
19
19
pragma [ nomagic]
@@ -24,27 +24,30 @@ private module Cached {
24
24
/** Gets the summary resulting from appending `step` to type-tracking summary `tt`. */
25
25
cached
26
26
TypeTracker append ( TypeTracker tt , StepSummary step ) {
27
- exists ( Boolean hasCall , OptionalTypeTrackerContent currentContent |
28
- tt = MkTypeTracker ( hasCall , currentContent )
27
+ exists ( Boolean hasCall , OptionalTypeTrackerContent currentContents |
28
+ tt = MkTypeTracker ( hasCall , currentContents )
29
29
|
30
30
step = LevelStep ( ) and result = tt
31
31
or
32
- step = CallStep ( ) and result = MkTypeTracker ( true , currentContent )
32
+ step = CallStep ( ) and result = MkTypeTracker ( true , currentContents )
33
33
or
34
34
step = ReturnStep ( ) and hasCall = false and result = tt
35
35
or
36
36
step = JumpStep ( ) and
37
- result = MkTypeTracker ( false , currentContent )
37
+ result = MkTypeTracker ( false , currentContents )
38
38
)
39
39
or
40
- exists ( TypeTrackerContentSet contents , boolean hasCall |
41
- step = LoadStep ( pragma [ only_bind_into ] ( contents ) ) and
42
- tt = MkTypeTracker ( hasCall , contents .getAReadContent ( ) ) and
43
- result = noContentTypeTracker ( hasCall )
40
+ exists ( TypeTrackerContent storeContents , boolean hasCall |
41
+ exists ( TypeTrackerContent loadContents |
42
+ step = LoadStep ( pragma [ only_bind_into ] ( loadContents ) ) and
43
+ tt = MkTypeTracker ( hasCall , storeContents ) and
44
+ compatibleContents ( storeContents , loadContents ) and
45
+ result = noContentTypeTracker ( hasCall )
46
+ )
44
47
or
45
- step = StoreStep ( pragma [ only_bind_into ] ( contents ) ) and
48
+ step = StoreStep ( pragma [ only_bind_into ] ( storeContents ) ) and
46
49
tt = noContentTypeTracker ( hasCall ) and
47
- result = MkTypeTracker ( hasCall , contents . getAStoreContent ( ) )
50
+ result = MkTypeTracker ( hasCall , storeContents )
48
51
)
49
52
}
50
53
@@ -69,14 +72,17 @@ private module Cached {
69
72
result = MkTypeBackTracker ( false , content )
70
73
)
71
74
or
72
- exists ( TypeTrackerContentSet contents , boolean hasReturn |
73
- step = StoreStep ( pragma [ only_bind_into ] ( contents ) ) and
74
- tbt = MkTypeBackTracker ( hasReturn , contents .getAReadContent ( ) ) and
75
- result = noContentTypeBackTracker ( hasReturn )
75
+ exists ( TypeTrackerContent loadContents , boolean hasReturn |
76
+ exists ( TypeTrackerContent storeContents |
77
+ step = StoreStep ( pragma [ only_bind_into ] ( storeContents ) ) and
78
+ tbt = MkTypeBackTracker ( hasReturn , loadContents ) and
79
+ compatibleContents ( storeContents , loadContents ) and
80
+ result = noContentTypeBackTracker ( hasReturn )
81
+ )
76
82
or
77
- step = LoadStep ( pragma [ only_bind_into ] ( contents ) ) and
83
+ step = LoadStep ( pragma [ only_bind_into ] ( loadContents ) ) and
78
84
tbt = noContentTypeBackTracker ( hasReturn ) and
79
- result = MkTypeBackTracker ( hasReturn , contents . getAStoreContent ( ) )
85
+ result = MkTypeBackTracker ( hasReturn , loadContents )
80
86
)
81
87
}
82
88
@@ -117,11 +123,9 @@ class StepSummary extends TStepSummary {
117
123
or
118
124
this instanceof ReturnStep and result = "return"
119
125
or
120
- exists ( TypeTrackerContentSet contents | this = StoreStep ( contents ) |
121
- result = "store " + contents
122
- )
126
+ exists ( TypeTrackerContent content | this = StoreStep ( content ) | result = "store " + content )
123
127
or
124
- exists ( TypeTrackerContentSet contents | this = LoadStep ( contents ) | result = "load " + contents )
128
+ exists ( TypeTrackerContent content | this = LoadStep ( content ) | result = "load " + content )
125
129
or
126
130
this instanceof JumpStep and result = "jump"
127
131
}
@@ -135,11 +139,11 @@ private predicate smallstepNoCall(Node nodeFrom, TypeTrackingNode nodeTo, StepSu
135
139
levelStep ( nodeFrom , nodeTo ) and
136
140
summary = LevelStep ( )
137
141
or
138
- exists ( TypeTrackerContentSet contents |
139
- StepSummary:: localSourceStoreStep ( nodeFrom , nodeTo , contents ) and
140
- summary = StoreStep ( contents )
142
+ exists ( TypeTrackerContent content |
143
+ StepSummary:: localSourceStoreStep ( nodeFrom , nodeTo , content ) and
144
+ summary = StoreStep ( content )
141
145
or
142
- basicLoadStep ( nodeFrom , nodeTo , contents ) and summary = LoadStep ( contents )
146
+ basicLoadStep ( nodeFrom , nodeTo , content ) and summary = LoadStep ( content )
143
147
)
144
148
}
145
149
@@ -185,7 +189,7 @@ module StepSummary {
185
189
}
186
190
187
191
/**
188
- * Holds if `nodeFrom` is being written to the `contents ` of the object in `nodeTo`.
192
+ * Holds if `nodeFrom` is being written to the `content ` of the object in `nodeTo`.
189
193
*
190
194
* Note that `nodeTo` will always be a local source node that flows to the place where the content
191
195
* is written in `basicStoreStep`. This may lead to the flow of information going "back in time"
@@ -204,15 +208,13 @@ module StepSummary {
204
208
* def bar(x):
205
209
* z = x.attr
206
210
* ```
207
- * for the attribute write `x.attr = y`, we will have `contents ` being the literal string `"attr"`,
211
+ * for the attribute write `x.attr = y`, we will have `content ` being the literal string `"attr"`,
208
212
* `nodeFrom` will be `y`, and `nodeTo` will be the object `Foo()` created on the first line of the
209
213
* function. This means we will track the fact that `x.attr` can have the type of `y` into the
210
214
* assignment to `z` inside `bar`, even though this attribute write happens _after_ `bar` is called.
211
215
*/
212
- predicate localSourceStoreStep (
213
- Node nodeFrom , TypeTrackingNode nodeTo , TypeTrackerContentSet contents
214
- ) {
215
- exists ( Node obj | nodeTo .flowsTo ( obj ) and basicStoreStep ( nodeFrom , obj , contents ) )
216
+ predicate localSourceStoreStep ( Node nodeFrom , TypeTrackingNode nodeTo , TypeTrackerContent content ) {
217
+ exists ( Node obj | nodeTo .flowsTo ( obj ) and basicStoreStep ( nodeFrom , obj , content ) )
216
218
}
217
219
}
218
220
0 commit comments