Skip to content

Commit 987870b

Browse files
authored
Merge pull request #10315 from hvitved/ruby/parameter-match-join
Ruby: Fix bad join in `parameterMatch`
2 parents 3bb7e28 + 8b8a662 commit 987870b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,12 @@ class ArgumentPosition extends TArgumentPosition {
567567
}
568568
}
569569

570+
pragma[nomagic]
571+
private predicate parameterPositionIsNotSelf(ParameterPosition ppos) { not ppos.isSelf() }
572+
573+
pragma[nomagic]
574+
private predicate argumentPositionIsNotSelf(ArgumentPosition apos) { not apos.isSelf() }
575+
570576
/** Holds if arguments at position `apos` match parameters at position `ppos`. */
571577
pragma[nomagic]
572578
predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) {
@@ -584,9 +590,9 @@ predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) {
584590
or
585591
ppos.isHashSplat() and apos.isHashSplat()
586592
or
587-
ppos.isAny() and not apos.isSelf()
593+
ppos.isAny() and argumentPositionIsNotSelf(apos)
588594
or
589-
apos.isAny() and not ppos.isSelf()
595+
apos.isAny() and parameterPositionIsNotSelf(ppos)
590596
or
591597
ppos.isAnyNamed() and apos.isKeyword(_)
592598
or

0 commit comments

Comments
 (0)