Skip to content

Commit 455cde2

Browse files
authored
Merge pull request #14267 from hvitved/ruby/fix-join
Ruby: Fix bad join
2 parents 07dbad5 + 1442bdd commit 455cde2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,12 @@ class ContentSet extends TContentSet {
740740
*/
741741
signature predicate guardChecksSig(CfgNodes::AstCfgNode g, CfgNode e, boolean branch);
742742

743+
bindingset[def1, def2]
744+
pragma[inline_late]
745+
private predicate sameSourceVariable(Ssa::Definition def1, Ssa::Definition def2) {
746+
def1.getSourceVariable() = def2.getSourceVariable()
747+
}
748+
743749
/**
744750
* Provides a set of barrier nodes for a guard that validates an expression.
745751
*
@@ -784,9 +790,9 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
784790
|
785791
def.getARead() = testedNode and
786792
guardChecks(g, testedNode, branch) and
787-
def.getSourceVariable() = result.getSourceVariable() and
788793
guardControlsBlock(g, call.getBasicBlock(), branch) and
789-
result.getBasicBlock().getScope() = call.getExpr().(MethodCall).getBlock()
794+
result.getBasicBlock().getScope() = call.getExpr().(MethodCall).getBlock() and
795+
sameSourceVariable(def, result)
790796
)
791797
}
792798
}
@@ -849,9 +855,9 @@ abstract deprecated class BarrierGuard extends CfgNodes::ExprCfgNode {
849855
|
850856
def.getARead() = testedNode and
851857
this.checks(testedNode, branch) and
852-
def.getSourceVariable() = result.getSourceVariable() and
853858
this.controlsBlock(call.getBasicBlock(), branch) and
854-
result.getBasicBlock().getScope() = call.getExpr().(MethodCall).getBlock()
859+
result.getBasicBlock().getScope() = call.getExpr().(MethodCall).getBlock() and
860+
sameSourceVariable(def, result)
855861
)
856862
}
857863

0 commit comments

Comments
 (0)