Skip to content

Commit 89c4b6c

Browse files
committed
Ruby: Fix isLocalSourceNode implementation
The old code was equivalent with the code below, which seems wrong ``` not n instanceof ExprNode or n instanceof ExprNode and localFlowStepTypeTracker+(..., n) ``` From running on real DB I found that this meant that the following node types were also included as local source nodes: - `TReturningNode` - `TSynthReturnNode` - `TSummaryNode` - `TSsaDefinitionNode` My understanding is that the first 3 should not be included. I would guess that SsaDefinitionNode should indeed be included as a LocalSourceNode, but I'm not 100% sure, so I'll see what the test results say before making further changes.
1 parent 56ed68b commit 89c4b6c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,12 @@ private module Cached {
303303
n instanceof PostUpdateNodes::ExprPostUpdateNode
304304
or
305305
// Expressions that can't be reached from another entry definition or expression.
306+
n instanceof ExprNode and
306307
not localFlowStepTypeTracker+(any(Node n0 |
307308
n0 instanceof ExprNode
308309
or
309310
entrySsaDefinition(n0)
310-
), n.(ExprNode))
311+
), n)
311312
or
312313
// Ensure all entry SSA definitions are local sources -- for parameters, this
313314
// is needed by type tracking. Note that when the parameter has a default value,

0 commit comments

Comments
 (0)