From 122101c9b29d6c8b524228100c316039331774e1 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Mon, 10 Aug 2026 10:21:48 +0200 Subject: [PATCH 1/2] Shared: Support empty try-body in CFG. --- shared/controlflow/codeql/controlflow/ControlFlowGraph.qll | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll index 920da5dd04ef..d41ad05daa34 100644 --- a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll +++ b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll @@ -1737,6 +1737,10 @@ module Make0 Ast> { not exists(trystmt.getFinally()) and beforeFinally.isAfter(trystmt) ) | + not exists(trystmt.getBody(_)) and + n1.isBefore(trystmt) and + n2 = beforeElse + or exists(int i | n1.isAfter(trystmt.getBody(i)) and not exists(trystmt.getBody(i + 1)) and From 5ffb8ec85818c819645e398ba02136e632185789 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Mon, 10 Aug 2026 12:43:08 +0200 Subject: [PATCH 2/2] Shared: Support exceptions in parameter defaults. --- .../controlflow/codeql/controlflow/ControlFlowGraph.qll | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll index d41ad05daa34..042aa29fc421 100644 --- a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll +++ b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll @@ -1269,6 +1269,10 @@ module Make0 Ast> { result = block.(Switch).getStmt(_) } + private predicate callableHasParamDefault(Callable c, Expr defaultValue) { + exists(Parameter p | p.getDefaultValue() = defaultValue and c = getEnclosingCallable(p)) + } + /** * Holds if an abrupt completion `c` from within `ast` is caught with * flow continuing at `n`. @@ -1276,7 +1280,9 @@ module Make0 Ast> { private predicate endAbruptCompletion(AstNode ast, PreControlFlowNode n, AbruptCompletion c) { Input2::endAbruptCompletion(ast, n, c) or - exists(Callable callable | callableHasBodyPart(callable, ast) | + exists(Callable callable | + callableHasBodyPart(callable, ast) or callableHasParamDefault(callable, ast) + | c.getSuccessorType() instanceof ReturnSuccessor and n.(NormalExitNodeImpl).getEnclosingCallable() = callable or