Skip to content

Commit 646eeee

Browse files
committed
Go: Fix two bad join orders
1 parent e053d3e commit 646eeee

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎go/ql/lib/semmle/go/controlflow/IR.qll‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ module IR {
247247

248248
override predicate reads(ValueEntity v) {
249249
e = v.getAReference() and
250-
e.(ReferenceExpr).isRvalue()
250+
pragma[only_bind_out](e).(ReferenceExpr).isRvalue()
251251
}
252252

253253
override Type getResultType() { result = e.getType() }

‎go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,16 +429,23 @@ module ParameterizedBarrierGuardValue<
429429
{
430430
private module WrappedGuardChecks = ParameterizedValidationWrapper<P, guardChecks/4>;
431431

432+
bindingset[guard, bb, value]
433+
pragma[inline_late]
434+
private predicate guardControlsBlock(Guard guard, BasicBlock bb, GuardValue value) {
435+
guard.valueControls(bb, value)
436+
}
437+
432438
/** Gets a node that is safely guarded by the given guard check. */
433439
Node getABarrierNode(P param) { result = getABarrierNodeForGuard(_, param) }
434440

435441
/**
436442
* Gets a node that is safely guarded by the given guard check.
437443
*/
438444
Node getABarrierNodeForGuard(Node guardCheck, P param) {
439-
exists(Guard guard, GuardValue value, SsaWithFields var | result = var.getAUse() |
445+
exists(Guard guard, GuardValue value, SsaWithFields var |
440446
guards(guardCheck, guard, value, _, var, param) and
441-
guard.valueControls(result.getBasicBlock(), value)
447+
result = pragma[only_bind_out](var).getAUse() and
448+
guardControlsBlock(guard, result.getBasicBlock(), value)
442449
)
443450
}
444451

0 commit comments

Comments
 (0)