]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make clang asan work with FORTIFIED_SOURCE again.
authorNick Mathewson <nickm@torproject.org>
Mon, 22 Feb 2016 19:07:58 +0000 (14:07 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 23 Feb 2016 19:05:34 +0000 (14:05 -0500)
Short version: clang asan hates the glibc strcmp macro in
bits/string2.h if you are passing it a constant string argument of
length two or less.  (I could be off by one here, but that's the
basic idea.)

Closes issue 14821.

changes/bug14821 [new file with mode: 0644]
src/common/compat.h

diff --git a/changes/bug14821 b/changes/bug14821
new file mode 100644 (file)
index 0000000..0920d1f
--- /dev/null
@@ -0,0 +1,4 @@
+  o Major bugfixes (compilation):
+    - Correctly repair hardened builds under the clang compiler. Previously,
+      our use of _FORTIFY_SOURCE would conflict with clang's address
+      sanitizer. Closes ticket 14821.
index c7c468c7545ca5d9b86dc3a67f999d4dbe650efc..66cc079259312e614ba5a31515e2f02213a24ad7 100644 (file)
 #include <netinet6/in6.h>
 #endif
 
+#if defined(__has_feature)
+#  if __has_feature(address_sanitizer)
+/* Some of the fancy glibc strcmp() macros include references to memory that
+ * clang rejects because it is off the end of a less-than-3. Clang hates this,
+ * even though those references never actually happen. */
+#    undef strcmp
+#  endif
+#endif
+
 #include <stdio.h>
 #include <errno.h>