Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby: Fix bad join #14267

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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