Skip to content

Commit 8c43ab6

Browse files
committed
Ruby: go to local source in load-store steps
1 parent 8b389fe commit 8c43ab6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ruby/ql/lib/codeql/ruby/typetracking/TypeTracker.qll

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private module Cached {
171171
)
172172
or
173173
exists(TypeTrackerContent loadContent, TypeTrackerContent storeContent |
174-
basicLoadStoreStep(nodeFrom, nodeTo, loadContent, storeContent) and
174+
flowsToLoadStoreStep(nodeFrom, nodeTo, loadContent, storeContent) and
175175
summary = LoadStoreStep(loadContent, storeContent)
176176
)
177177
}
@@ -218,6 +218,18 @@ private predicate flowsToStoreStep(
218218
exists(Node obj | nodeTo.flowsTo(obj) and basicStoreStep(nodeFrom, obj, content))
219219
}
220220

221+
/**
222+
* Holds if `loadContent` is loaded from `nodeFrom` and written to `storeContent` of `nodeTo`.
223+
*/
224+
predicate flowsToLoadStoreStep(
225+
Node nodeFrom, TypeTrackingNode nodeTo, TypeTrackerContent loadContent,
226+
TypeTrackerContent storeContent
227+
) {
228+
exists(Node obj |
229+
nodeTo.flowsTo(obj) and basicLoadStoreStep(nodeFrom, obj, loadContent, storeContent)
230+
)
231+
}
232+
221233
/**
222234
* INTERNAL: Use `TypeTracker` or `TypeBackTracker` instead.
223235
*

0 commit comments

Comments
 (0)