aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-09-14 16:34:07 +0300
committerJia Tan <jiat0218@gmail.com>2023-10-31 01:03:25 +0800
commitcaf00e0988ba47842cfd93dfbb17f7d30120d6e7 (patch)
tree9a66d0502171a08ee5137ec3e3d4a7964e379ef7
parentCMake: Fix time.h checks not running on second CMake run. (diff)
downloadxz-caf00e0988ba47842cfd93dfbb17f7d30120d6e7.tar.xz
liblzma: Mark crc64_clmul() with __attribute__((__no_sanitize_address__)).
Thanks to Agostino Sarubbo. Fixes: https://github.com/tukaani-project/xz/issues/62
-rw-r--r--src/liblzma/check/crc64_fast.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/liblzma/check/crc64_fast.c b/src/liblzma/check/crc64_fast.c
index e686dbd7..0c8622a1 100644
--- a/src/liblzma/check/crc64_fast.c
+++ b/src/liblzma/check/crc64_fast.c
@@ -206,6 +206,14 @@ calc_hi(uint64_t poly, uint64_t a)
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
__attribute__((__target__("ssse3,sse4.1,pclmul")))
#endif
+// The intrinsics use 16-byte-aligned reads from buf, thus they may read
+// up to 15 bytes before or after the buffer (depending on the alignment
+// of the buf argument). The values of the extra bytes are ignored.
+// This unavoidably trips -fsanitize=address so address sanitizier has
+// to be disabled for this function.
+#if lzma_has_attribute(__no_sanitize_address__)
+__attribute__((__no_sanitize_address__))
+#endif
static uint64_t
crc64_clmul(const uint8_t *buf, size_t size, uint64_t crc)
{