From b18bca672d2c0e2548c1fd536276297a14a7bfd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jiri=20Dan=C4=9Bk?= Date: Thu, 17 Feb 2022 16:45:15 +0100 Subject: [PATCH] DISPATCH-1783 Fix Aarch64 ubsan warning in cpp-stub assigning to misaligned variable --- tests/cpp-stub/cpp_stub.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cpp-stub/cpp_stub.h b/tests/cpp-stub/cpp_stub.h index 7532ede59..a2b2d461a 100644 --- a/tests/cpp-stub/cpp_stub.h +++ b/tests/cpp-stub/cpp_stub.h @@ -46,7 +46,7 @@ #define REPLACE_FAR(t, fn, fn_stub)\ ((uint32_t*)fn)[0] = 0x58000040 | 9;\ ((uint32_t*)fn)[1] = 0xd61f0120 | (9 << 5);\ - *(long long *)(fn + 8) = (long long )fn_stub;\ + memcpy((long long *)(fn + 8), &fn_stub, sizeof(long long));\ CACHEFLUSH((char *)fn, CODESIZE); #define REPLACE_NEAR(t, fn, fn_stub) REPLACE_FAR(t, fn, fn_stub) #elif defined(__arm__) || defined(_M_ARM)