From f170141040f74c01312f4c31e37c94c5223ca3f0 Mon Sep 17 00:00:00 2001 From: Ashkan Kiani Date: Fri, 20 Aug 2021 01:47:31 +0900 Subject: [PATCH] Show a compile error if used with ASAN --- meow_hash_x64_aesni.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meow_hash_x64_aesni.h b/meow_hash_x64_aesni.h index 966557d..65ed212 100644 --- a/meow_hash_x64_aesni.h +++ b/meow_hash_x64_aesni.h @@ -352,6 +352,9 @@ MeowHash(void *Seed128Init, meow_umm Len, void *SourceInit) meow_u8 *LastOk = (meow_u8*)((((meow_umm)(((meow_u8 *)SourceInit)+Len - 1)) | (MEOW_PAGESIZE - 1)) - 16); int Align = (Last > LastOk) ? ((int)(meow_umm)Last) & 0xf : 0; movdqu(xmm10, &MeowShiftAdjust[Align]); +#if defined(__SANITIZE_ADDRESS__) || (defined(__clang__) && __has_feature(address_sanitizer)) +#error ASAN falsely believes that this is a heap-buffer-overflow https://github.com/cmuratori/meow_hash/issues/79 +#endif movdqu(xmm9, Last - Align); pshufb(xmm9, xmm10);