From fdac4da3029104c2aa83d4e7f110082ec668bcca Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 6 Oct 2020 17:31:31 +0200 Subject: [PATCH] skip address read oob in lz4 for now --- common/lz4/lz4.c | 2 ++ common/lz4/lz4.h | 5 +++++ common/lz4/lz4hc.c | 6 ------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/common/lz4/lz4.c b/common/lz4/lz4.c index ac6cbbb99..67db8367e 100644 --- a/common/lz4/lz4.c +++ b/common/lz4/lz4.c @@ -322,6 +322,8 @@ static void LZ4_write32(void *memPtr, U32 value) { *(U32 *)memPtr = value; } typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) unalign; static U16 LZ4_read16(const void *ptr) { return ((const unalign *)ptr)->u16; } +// Tolerate reads on buffer boundary +ATTRIBUTE_NO_SANITIZE_ADDRESS static U32 LZ4_read32(const void *ptr) { return ((const unalign *)ptr)->u32; } static reg_t LZ4_read_ARCH(const void *ptr) { return ((const unalign *)ptr)->uArch; } diff --git a/common/lz4/lz4.h b/common/lz4/lz4.h index bc8df87b7..42aedbbc3 100644 --- a/common/lz4/lz4.h +++ b/common/lz4/lz4.h @@ -42,6 +42,11 @@ extern "C" { /* --- Dependency --- */ #include /* size_t */ +#if defined(__clang__) || defined (__GNUC__) +# define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) +#else +# define ATTRIBUTE_NO_SANITIZE_ADDRESS +#endif /** Introduction diff --git a/common/lz4/lz4hc.c b/common/lz4/lz4hc.c index 6e74164a5..e92d63fe2 100644 --- a/common/lz4/lz4hc.c +++ b/common/lz4/lz4hc.c @@ -61,12 +61,6 @@ # pragma clang diagnostic ignored "-Wunused-function" #endif -#if defined(__clang__) || defined (__GNUC__) -# define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) -#else -# define ATTRIBUTE_NO_SANITIZE_ADDRESS -#endif - /*=== Enums ===*/ typedef enum { noDictCtx, usingDictCtxHc } dictCtx_directive;