summaryrefslogtreecommitdiff
path: root/src/pal/src/memory/local.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/src/memory/local.cpp')
-rw-r--r--src/pal/src/memory/local.cpp47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/pal/src/memory/local.cpp b/src/pal/src/memory/local.cpp
index 3a0f40f8c4..44d9feb0c5 100644
--- a/src/pal/src/memory/local.cpp
+++ b/src/pal/src/memory/local.cpp
@@ -26,6 +26,14 @@ Revision History:
SET_DEFAULT_DEBUG_CHANNEL(MEM);
+#ifdef TIZEN_ASAN_ENVIRONMENT
+extern "C" {
+extern void __sanitizer_disable_interceptors() __attribute__ ((weak));
+extern void __sanitizer_enable_interceptors() __attribute__ ((weak));
+extern bool __sanitizer_interceptors_are_enabled() __attribute__ ((weak));
+}
+#endif
+
static
int
AllocFlagsToHeapAllocFlags (IN UINT AllocFlags,
@@ -70,7 +78,24 @@ LocalAlloc(
goto done;
}
- lpRetVal = HeapAlloc( GetProcessHeap(), uFlags, uBytes );
+#ifdef TIZEN_ASAN_ENVIRONMENT
+ if (__sanitizer_interceptors_are_enabled != NULL)
+ {
+ bool san_enabled;
+ san_enabled = __sanitizer_interceptors_are_enabled();
+ if (!san_enabled) {
+ __sanitizer_enable_interceptors();
+ }
+ lpRetVal = HeapAlloc( GetProcessHeap(), uFlags, uBytes );
+ if (!san_enabled) {
+ __sanitizer_disable_interceptors();
+ }
+ }
+ else
+#endif
+ {
+ lpRetVal = HeapAlloc( GetProcessHeap(), uFlags, uBytes );
+ }
done:
LOGEXIT( "LocalAlloc returning %p.\n", lpRetVal );
@@ -128,7 +153,25 @@ LocalFree(
if ( hMem )
{
- bRetVal = HeapFree( GetProcessHeap(), 0, hMem );
+#ifdef TIZEN_ASAN_ENVIRONMENT
+ if (__sanitizer_interceptors_are_enabled != NULL)
+ {
+ bool san_enabled;
+ san_enabled = __sanitizer_interceptors_are_enabled();
+ if (!san_enabled) {
+ __sanitizer_enable_interceptors();
+ }
+ bRetVal = HeapFree( GetProcessHeap(), 0, hMem );
+ if (!san_enabled) {
+ __sanitizer_disable_interceptors();
+ }
+ }
+ else
+#endif
+ {
+ bRetVal = HeapFree( GetProcessHeap(), 0, hMem );
+ }
+
}
else
{