From 265dd37c909bfedd43112a36e111e061912bfc8c Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Tue, 3 Nov 2026 09:07:57 +0100 Subject: [PATCH] Fix shared CFG abrupt completions Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../codeql/controlflow/ControlFlowGraph.qll | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll index cd7fa6a4ee27..395ed815ca74 100644 --- a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll +++ b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll @@ -1254,28 +1254,28 @@ module Make0 Ast> { or n.isIn(ast) and always = true and - ( + exists(SuccessorType st | ast instanceof ReturnStmt and - c.getSuccessorType() instanceof ReturnSuccessor + st instanceof ReturnSuccessor or ast instanceof Throw and - c.getSuccessorType() instanceof ExceptionSuccessor + st instanceof ExceptionSuccessor or ast instanceof BreakStmt and - c.getSuccessorType() instanceof BreakSuccessor + st instanceof BreakSuccessor or ast instanceof ContinueStmt and - c.getSuccessorType() instanceof ContinueSuccessor + st instanceof ContinueSuccessor or ast instanceof GotoStmt and - c.getSuccessorType() instanceof GotoSuccessor - ) and - ( - not Input1::hasLabel(ast, _) and not c.hasLabel(_) + st instanceof GotoSuccessor + | + not Input1::hasLabel(ast, _) and + c = TSimpleAbruptCompletion(st) or exists(Input1::Label l | Input1::hasLabel(ast, l) and - c.hasLabel(l) + c = TLabeledAbruptCompletion(st, l) ) ) or @@ -1319,20 +1319,19 @@ module Make0 Ast> { n.(ExceptionalExitNodeImpl).getEnclosingCallable() = callable ) or - exists(LoopStmt loop | ast = pragma[only_bind_into](loop).getBody() | + exists(LoopStmt loop, SuccessorType st | ast = pragma[only_bind_into](loop).getBody() | ( - c.getSuccessorType() instanceof BreakSuccessor and + st instanceof BreakSuccessor and n.isAfter(loop) or - c.getSuccessorType() instanceof ContinueSuccessor and + st instanceof ContinueSuccessor and n.isAdditional(loop, loopHeaderTag()) ) and ( - not c.hasLabel(_) + c = TSimpleAbruptCompletion(st) or - exists(Input1::Label l | - c.hasLabel(l) and - (Input1::hasLabel(loop, l) or hasEnclosingLabel(loop, l)) + exists(Input1::Label l | c = TLabeledAbruptCompletion(st, l) | + Input1::hasLabel(loop, l) or hasEnclosingLabel(loop, l) ) ) )