Skip to content

Commit 7355f55

Browse files
committed
C++: Add an exception edge out of calls inside try statements.
1 parent 4bed44d commit 7355f55

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ private import semmle.code.cpp.ir.implementation.internal.OperandTag
44
private import semmle.code.cpp.ir.internal.CppType
55
private import semmle.code.cpp.models.interfaces.SideEffect
66
private import semmle.code.cpp.models.interfaces.Throwing
7+
private import semmle.code.cpp.models.interfaces.NonThrowing
78
private import InstructionTag
89
private import SideEffects
910
private import TranslatedElement
@@ -366,6 +367,10 @@ class TranslatedFunctionCall extends TranslatedCallExpr, TranslatedDirectCall {
366367
or
367368
exists(MicrosoftTryStmt tryStmt | tryStmt.getStmt() = expr.getEnclosingStmt().getParent*()) and
368369
e instanceof SehExceptionEdge
370+
or
371+
not expr.getTarget() instanceof NonCppThrowingFunction and
372+
exists(TryStmt tryStmt | tryStmt.getStmt() = expr.getEnclosingStmt().getParent*()) and
373+
e instanceof CppExceptionEdge
369374
}
370375

371376
final override predicate mustThrowException(ExceptionEdge e) {

0 commit comments

Comments
 (0)