Skip to content

Commit b55bce4

Browse files
committed
C#: Restrict non-returning CIL analysis to methods not from source
1 parent 0d14b94 commit b55bce4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

csharp/ql/src/semmle/code/csharp/controlflow/internal/NonReturning.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ private class ThrowingCall extends NonReturningCall {
3939
or
4040
this.(FailingAssertion).getAssertionFailure().isException(c.getExceptionClass())
4141
or
42-
exists(CIL::Method m, CIL::Type ex |
43-
this.getTarget().matchesHandle(m) and
42+
exists(Callable target, CIL::Method m, CIL::Type ex |
43+
target = this.getTarget() and
44+
not target.hasBody() and
45+
target.matchesHandle(m) and
4446
alwaysThrowsException(m, ex) and
4547
c.getExceptionClass().matchesHandle(ex) and
4648
not m.isVirtual()

0 commit comments

Comments
 (0)