Skip to content

Commit 583de24

Browse files
authored
[DeviceSanitizer][Coverity] die when fail to create context (#17600)
There is uncaught exception through logger creation in sanitizer layer `context_t` 's creation. We catch exceptions here and die if the creation of sanitizer layer context fails.
1 parent 7fd728d commit 583de24

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

unified-runtime/source/loader/layers/sanitizer/ur_sanitizer_layer.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@
1616
#include "msan/msan_ddi.hpp"
1717

1818
namespace ur_sanitizer_layer {
19-
context_t *getContext() { return context_t::get_direct(); }
19+
context_t *getContext() {
20+
try {
21+
return context_t::get_direct();
22+
} catch (...) {
23+
die("Failed to get sanitizer context.");
24+
}
25+
}
2026

2127
///////////////////////////////////////////////////////////////////////////////
2228
context_t::context_t()

0 commit comments

Comments
 (0)