]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Disable asan for specific bad parts of the code
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Sep 2019 14:57:17 +0000 (15:57 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Sep 2019 14:57:17 +0000 (15:57 +0100)
config.h.in
contrib/lc-btrie/btrie.c
contrib/t1ha/t1ha_bits.h

index 57b887b85726a6f432e0f1bbc33d3d07a6544bbf..f36a3a474f87ed9d21bea8e69bdb2b5021550130 100644 (file)
@@ -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
index 8b598b09bb12736017edfb377b383451d996c2ee..6e529db901e1a13fe801fe6cc9c8479ad57861dd 100644 (file)
@@ -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;
index 799737d5fe83238172360d597691142d26aec484..5710d2dbf3f709a1f1e80da938cf4d9642593b75 100644 (file)
 #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__)