summaryrefslogtreecommitdiff
path: root/src/cxa_exception.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cxa_exception.cpp')
-rw-r--r--src/cxa_exception.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index 0794444..204ea2d 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -19,6 +19,10 @@
#include "cxa_handlers.hpp"
#include "fallback_malloc.h"
+#if __has_feature(address_sanitizer)
+#include <sanitizer/asan_interface.h>
+#endif
+
// +---------------------------+-----------------------------+---------------+
// | __cxa_exception | _Unwind_Exception CLNGC++\0 | thrown object |
// +---------------------------+-----------------------------+---------------+
@@ -217,6 +221,12 @@ __cxa_throw(void *thrown_object, std::type_info *tinfo, void (*dest)(void *)) {
globals->uncaughtExceptions += 1; // Not atomically, since globals are thread-local
exception_header->unwindHeader.exception_cleanup = exception_cleanup_func;
+
+#if __has_feature(address_sanitizer)
+ // Inform the ASan runtime that now might be a good time to clean stuff up.
+ __asan_handle_no_return();
+#endif
+
#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
#else