Skip to content

Commit 790d977

Browse files
committed
Ruby: Replace Element with Element[any]
To make it look more like `Argument` tokens.
1 parent d1c9d68 commit 790d977

File tree

3 files changed

+110
-112
lines changed

3 files changed

+110
-112
lines changed

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,18 @@ SummaryComponent interpretComponentSpecific(AccessPathToken c) {
7474
)
7575
or
7676
c.getName() = "Element" and
77-
(
78-
c.getNumArgument() = 0 and
77+
exists(string arg | arg = c.getAnArgument() |
78+
arg = "?" and
79+
result = FlowSummary::SummaryComponent::elementUnknown()
80+
or
81+
arg = "any" and
7982
result = FlowSummary::SummaryComponent::elementAny()
8083
or
81-
exists(string arg | arg = c.getAnArgument() |
82-
arg = "?" and
83-
result = FlowSummary::SummaryComponent::elementUnknown()
84+
exists(ConstantValue cv | result = FlowSummary::SummaryComponent::elementKnown(cv) |
85+
cv.isInt(AccessPath::parseInt(arg))
8486
or
85-
exists(ConstantValue cv | result = FlowSummary::SummaryComponent::elementKnown(cv) |
86-
cv.isInt(AccessPath::parseInt(arg))
87-
or
88-
not exists(AccessPath::parseInt(arg)) and
89-
cv.serialize() = c.getAnArgument()
90-
)
87+
not exists(AccessPath::parseInt(arg)) and
88+
cv.serialize() = c.getAnArgument()
9189
)
9290
)
9391
}

0 commit comments

Comments
 (0)