Skip to content

Commit

Permalink
Merge pull request #14267 from hvitved/ruby/fix-join
Browse files Browse the repository at this point in the history
Ruby: Fix bad join
  • Loading branch information
hvitved authored Sep 20, 2023
2 parents 07dbad5 + 1442bdd commit 455cde2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPublic.qll
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,12 @@ class ContentSet extends TContentSet {
*/
signature predicate guardChecksSig(CfgNodes::AstCfgNode g, CfgNode e, boolean branch);

bindingset[def1, def2]
pragma[inline_late]
private predicate sameSourceVariable(Ssa::Definition def1, Ssa::Definition def2) {
def1.getSourceVariable() = def2.getSourceVariable()
}

/**
* Provides a set of barrier nodes for a guard that validates an expression.
*
Expand Down Expand Up @@ -784,9 +790,9 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
|
def.getARead() = testedNode and
guardChecks(g, testedNode, branch) and
def.getSourceVariable() = result.getSourceVariable() and
guardControlsBlock(g, call.getBasicBlock(), branch) and
result.getBasicBlock().getScope() = call.getExpr().(MethodCall).getBlock()
result.getBasicBlock().getScope() = call.getExpr().(MethodCall).getBlock() and
sameSourceVariable(def, result)
)
}
}
Expand Down Expand Up @@ -849,9 +855,9 @@ abstract deprecated class BarrierGuard extends CfgNodes::ExprCfgNode {
|
def.getARead() = testedNode and
this.checks(testedNode, branch) and
def.getSourceVariable() = result.getSourceVariable() and
this.controlsBlock(call.getBasicBlock(), branch) and
result.getBasicBlock().getScope() = call.getExpr().(MethodCall).getBlock()
result.getBasicBlock().getScope() = call.getExpr().(MethodCall).getBlock() and
sameSourceVariable(def, result)
)
}

Expand Down

0 comments on commit 455cde2

Please sign in to comment.