Skip to content

Commit 66f88d9

Browse files
committed
C++: Restrict the AST cases in TReturnKind.
1 parent 19b14e1 commit 66f88d9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@ private newtype TReturnKind =
466466
// (this approach includes functions declared that have no body; they may still have flow summaries)
467467
indirectionIndex =
468468
[0 .. max(Cpp::Function f |
469-
|
469+
not exists(f.getBlock())
470+
|
470471
Ssa::getMaxIndirectionsForType(f.getUnspecifiedType()) - 1 // -1 because a returned value is a prvalue not a glvalue
471472
)]
472473
} or
@@ -480,7 +481,8 @@ private newtype TReturnKind =
480481
// derive a possible return argument from the AST
481482
indirectionIndex =
482483
[0 .. max(Cpp::Function f |
483-
|
484+
not exists(f.getBlock())
485+
|
484486
Ssa::getMaxIndirectionsForType(f.getParameter(argumentIndex).getUnspecifiedType()) - 1 // -1 because an argument is a prvalue not a glvalue
485487
)]
486488
}

0 commit comments

Comments
 (0)