summaryrefslogtreecommitdiff
path: root/Source/UnitTests/Core/PageFaultTest.cpp
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2020-08-18 21:54:08 -0700
committerShawn Hoffman <godisgovernment@gmail.com>2021-01-10 15:11:18 -0800
commit49b9deeb03ef92844ce826bf52a4e5baeb7fca9b (patch)
tree434ffe3079b5bbe60be5012b3241a539b7aaf495 /Source/UnitTests/Core/PageFaultTest.cpp
parent79a234eff728b2aeb68c9848f2e4fe861d4f3b91 (diff)
msvc: add asan support (disabled by default)
Diffstat (limited to 'Source/UnitTests/Core/PageFaultTest.cpp')
-rw-r--r--Source/UnitTests/Core/PageFaultTest.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/UnitTests/Core/PageFaultTest.cpp b/Source/UnitTests/Core/PageFaultTest.cpp
index 7b6210d7b9..e77fe49fd2 100644
--- a/Source/UnitTests/Core/PageFaultTest.cpp
+++ b/Source/UnitTests/Core/PageFaultTest.cpp
@@ -49,6 +49,17 @@ public:
m_post_unprotect_time;
};
+#ifdef _MSC_VER
+#define ASAN_DISABLE __declspec(no_sanitize_address)
+#else
+#define ASAN_DISABLE
+#endif
+
+static void ASAN_DISABLE perform_invalid_access(void* data)
+{
+ *(volatile int*)data = 5;
+}
+
TEST(PageFault, PageFault)
{
EMM::InstallExceptionHandler();
@@ -61,7 +72,7 @@ TEST(PageFault, PageFault)
pfjit.m_data = data;
auto start = std::chrono::high_resolution_clock::now();
- *(volatile int*)data = 5;
+ perform_invalid_access(data);
auto end = std::chrono::high_resolution_clock::now();
#define AS_NS(diff) \