diff --git a/ql/lib/semmle/go/controlflow/ControlFlowGraphImpl.qll b/ql/lib/semmle/go/controlflow/ControlFlowGraphImpl.qll index 35caa5d7cbc..3b9d1571343 100644 --- a/ql/lib/semmle/go/controlflow/ControlFlowGraphImpl.qll +++ b/ql/lib/semmle/go/controlflow/ControlFlowGraphImpl.qll @@ -652,7 +652,7 @@ module CFG { AtomicTree() { exists(Expr e | - e = this.(Expr) and + e = this and e.isConst() and nd = mkExprOrSkipNode(this) | diff --git a/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll b/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll index 8f2eee86ec6..f33048ed08a 100644 --- a/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll +++ b/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll @@ -289,7 +289,7 @@ private predicate isPossibleInputNode(DataFlow::Node inputNode, FuncDef fd) { private ControlFlow::Node getANonTestPassingPredecessor( ControlFlow::Node succ, DataFlow::Node inputNode ) { - isPossibleInputNode(inputNode, succ.getRoot().(FuncDef)) and + isPossibleInputNode(inputNode, succ.getRoot()) and result = succ.getAPredecessor() and not exists(Expr testExpr, DataFlow::Node switchExprNode | flowsToSwitchExpression(inputNode, switchExprNode) and @@ -301,7 +301,7 @@ private ControlFlow::Node getANonTestPassingPredecessor( private ControlFlow::Node getANonTestPassingReachingNodeRecursive( ControlFlow::Node n, DataFlow::Node inputNode ) { - isPossibleInputNode(inputNode, n.getRoot().(FuncDef)) and + isPossibleInputNode(inputNode, n.getRoot()) and ( result = n or result = @@ -328,7 +328,7 @@ private ControlFlow::Node getANonTestPassingReachingNodeBase( private predicate mustPassConstantCaseTestToReach( IR::ReturnInstruction ret, DataFlow::Node inputNode ) { - isPossibleInputNode(inputNode, ret.getRoot().(FuncDef)) and + isPossibleInputNode(inputNode, ret.getRoot()) and not exists(ControlFlow::Node entry | entry = ret.getRoot().getEntryNode() | entry = getANonTestPassingReachingNodeBase(ret, inputNode) ) diff --git a/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql b/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql index 2e4f25fe495..253d598835d 100644 --- a/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql +++ b/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql @@ -47,10 +47,10 @@ predicate callGraphEdge(CallGraphNode pred, CallGraphNode succ) { pred.(CallExpr) = succ.(FuncDef).getACall().asExpr() or // Go from a function to an enclosed loop. - pred.(FuncDef) = succ.(LoopStmt).getEnclosingFunction() + pred = succ.(LoopStmt).getEnclosingFunction() or // Go from a function to an enclosed call. - pred.(FuncDef) = succ.(CallExpr).getEnclosingFunction() + pred = succ.(CallExpr).getEnclosingFunction() } query predicate edges(CallGraphNode pred, CallGraphNode succ) { diff --git a/ql/src/experimental/IntegerOverflow/RangeAnalysis.qll b/ql/src/experimental/IntegerOverflow/RangeAnalysis.qll index a1d2ec581e8..cff3873a0d6 100644 --- a/ql/src/experimental/IntegerOverflow/RangeAnalysis.qll +++ b/ql/src/experimental/IntegerOverflow/RangeAnalysis.qll @@ -535,8 +535,7 @@ float getAnSsaLowerBound(SsaDefinition def) { predicate ssaDependsOnSsa(SsaDefinition nextDef, SsaDefinition prevDef) { //SSA definition coresponding to a `SimpleAssignStmt` exists(SimpleAssignStmt simpleAssign, int i | - nextDef.(SsaExplicitDefinition).getInstruction().(IR::AssignInstruction) = - IR::assignInstruction(simpleAssign, i) and + nextDef.(SsaExplicitDefinition).getInstruction() = IR::assignInstruction(simpleAssign, i) and ssaDependsOnExpr(prevDef, simpleAssign.getRhs()) ) or