diff options
-rw-r--r-- | config.h.in | 22 | ||||
-rw-r--r-- | contrib/lc-btrie/btrie.c | 2 | ||||
-rw-r--r-- | contrib/t1ha/t1ha_bits.h | 4 |
3 files changed, 23 insertions, 5 deletions
diff --git a/config.h.in b/config.h.in index 57b887b85..f36a3a474 100644 --- a/config.h.in +++ b/config.h.in @@ -370,6 +370,28 @@ typedef off_t goffset; #endif #endif +/* Address sanitizer */ +#ifdef __clang__ +# if __has_feature(address_sanitizer) +/* emulate gcc's __SANITIZE_ADDRESS__ flag */ +# define __SANITIZE_ADDRESS__ +# define RSPAMD_NO_SANITIZE \ + __attribute__((no_sanitize("address", "hwaddress"))) +# else +# define RSPAMD_NO_SANITIZE +# endif +#elif defined(__GNUC__) +/* GCC based */ +# if __has_attribute(__no_sanitize_address__) +# define RSPAMD_NO_SANITIZE __attribute__((no_sanitize_address)) +# else +# define RSPAMD_NO_SANITIZE +# endif +#else +# define RSPAMD_NO_SANITIZE +#endif + + #ifndef BITSPERBYTE # define BITSPERBYTE (NBBY * sizeof (char)) #endif diff --git a/contrib/lc-btrie/btrie.c b/contrib/lc-btrie/btrie.c index 8b598b09b..6e529db90 100644 --- a/contrib/lc-btrie/btrie.c +++ b/contrib/lc-btrie/btrie.c @@ -632,7 +632,7 @@ static inline unsigned count_bits_from(tbm_bitmap_t bm, int b) /* extracts a few bits from bitstring, returning them as an integer */ static inline btrie_oct_t extract_bits(const btrie_oct_t *prefix, unsigned pos, - unsigned nbits) + unsigned nbits) RSPAMD_NO_SANITIZE { if (nbits == 0) return 0; diff --git a/contrib/t1ha/t1ha_bits.h b/contrib/t1ha/t1ha_bits.h index 799737d5f..5710d2dbf 100644 --- a/contrib/t1ha/t1ha_bits.h +++ b/contrib/t1ha/t1ha_bits.h @@ -120,10 +120,6 @@ #define __has_extension(x) (0) #endif -#if __has_feature(address_sanitizer) -#define __SANITIZE_ADDRESS__ 1 -#endif - #if __GNUC_PREREQ(4, 4) || defined(__clang__) #if defined(__ia32__) || defined(__e2k__) |