summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraidanfnv <aidanf@nvidia.com>2025-07-07 11:03:39 -0700
committerGitHub <noreply@github.com>2025-07-07 18:03:39 +0000
commit7119d9cb487d866d1c25e55eafa03aca6e5e52e3 (patch)
treea1126c307eb0662e4b11061b49ea84702528fcee
parentb282c88d9743fc9bb60ef27cfa5d9cf58cccd60b (diff)
Catch abort exception from leaking from loadModule (#7627)
-rw-r--r--source/slang/slang.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 9bfc2bce9..e76ff7436 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -1496,13 +1496,29 @@ static void outputExceptionDiagnostic(
DiagnosticSink& sink,
slang::IBlob** outDiagnostics)
{
- sink.diagnoseRaw(Severity::Internal, exception.Message.getUnownedSlice());
+ try
+ {
+ sink.diagnoseRaw(Severity::Internal, exception.Message.getUnownedSlice());
+ }
+ catch (const AbortCompilationException&)
+ {
+ // Catch and ignore the AbortCompilationException that diagnoseRaw throws
+ // for Internal severity to prevent exception leak from loadModule
+ }
sink.getBlobIfNeeded(outDiagnostics);
}
static void outputExceptionDiagnostic(DiagnosticSink& sink, slang::IBlob** outDiagnostics)
{
- sink.diagnoseRaw(Severity::Fatal, "An unknown exception occurred");
+ try
+ {
+ sink.diagnoseRaw(Severity::Fatal, "An unknown exception occurred");
+ }
+ catch (const AbortCompilationException&)
+ {
+ // Catch and ignore the AbortCompilationException that diagnoseRaw throws
+ // for Fatal severity to prevent exception leak from loadModule
+ }
sink.getBlobIfNeeded(outDiagnostics);
}