Skip to content

Commit 3544c85

Browse files
committed
Ruby: Make the target of basicStoreStep the post-update node
1 parent 1101b10 commit 3544c85

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ predicate basicStoreStep(Node nodeFrom, Node nodeTo, string content) {
103103
// TODO: support SetterMethodCall inside TuplePattern
104104
exists(ExprNodes::MethodCallCfgNode call |
105105
content = getSetterCallAttributeName(call.getExpr()) and
106-
nodeTo.(DataFlowPublic::ExprNode).getExprNode() = call.getReceiver() and
106+
nodeTo.(DataFlowPrivate::PostUpdateNode).getPreUpdateNode().asExpr() = call.getReceiver() and
107107
call.getExpr() instanceof AST::SetterMethodCall and
108108
call.getArgument(call.getNumberOfArguments() - 1) =
109109
nodeFrom.(DataFlowPublic::ExprNode).getExprNode()

ruby/ql/test/library-tests/dataflow/type-tracker/TypeTracker.expected

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@ track
5555
| type_tracker.rb:14:5:14:13 | call to field= | type tracker without call steps | type_tracker.rb:14:5:14:13 | call to field= |
5656
| type_tracker.rb:14:17:14:23 | "hello" | type tracker with call steps | type_tracker.rb:2:16:2:18 | val |
5757
| type_tracker.rb:14:17:14:23 | "hello" | type tracker with call steps | type_tracker.rb:2:16:2:18 | val |
58-
| type_tracker.rb:14:17:14:23 | "hello" | type tracker with call steps | type_tracker.rb:3:14:3:23 | call to field |
59-
| type_tracker.rb:14:17:14:23 | "hello" | type tracker with call steps with content field | type_tracker.rb:2:5:5:7 | self in field= |
6058
| type_tracker.rb:14:17:14:23 | "hello" | type tracker with call steps with content field | type_tracker.rb:7:5:9:7 | self in field |
6159
| type_tracker.rb:14:17:14:23 | "hello" | type tracker without call steps | type_tracker.rb:14:17:14:23 | "hello" |
6260
| type_tracker.rb:14:17:14:23 | "hello" | type tracker without call steps | type_tracker.rb:15:10:15:18 | call to field |
63-
| type_tracker.rb:14:17:14:23 | "hello" | type tracker without call steps with content field | type_tracker.rb:13:11:13:23 | call to new |
61+
| type_tracker.rb:14:17:14:23 | "hello" | type tracker without call steps with content field | type_tracker.rb:14:5:14:7 | [post] var |
6462
| type_tracker.rb:15:5:15:18 | [post] self | type tracker without call steps | type_tracker.rb:15:5:15:18 | [post] self |
6563
| type_tracker.rb:15:5:15:18 | call to puts | type tracker without call steps | type_tracker.rb:12:1:16:3 | return return in m |
6664
| type_tracker.rb:15:5:15:18 | call to puts | type tracker without call steps | type_tracker.rb:15:5:15:18 | call to puts |
@@ -125,7 +123,6 @@ trackEnd
125123
| type_tracker.rb:14:5:14:13 | call to field= | type_tracker.rb:14:5:14:13 | call to field= |
126124
| type_tracker.rb:14:17:14:23 | "hello" | type_tracker.rb:2:16:2:18 | val |
127125
| type_tracker.rb:14:17:14:23 | "hello" | type_tracker.rb:2:16:2:18 | val |
128-
| type_tracker.rb:14:17:14:23 | "hello" | type_tracker.rb:3:14:3:23 | call to field |
129126
| type_tracker.rb:14:17:14:23 | "hello" | type_tracker.rb:14:17:14:23 | "hello" |
130127
| type_tracker.rb:14:17:14:23 | "hello" | type_tracker.rb:15:10:15:18 | call to field |
131128
| type_tracker.rb:15:5:15:18 | [post] self | type_tracker.rb:15:5:15:18 | [post] self |

0 commit comments

Comments
 (0)