[glib/wip/smcv/address-sanitizer: 3/3] error test: Don't test programmer error under AddressSanitizer




commit c9942d8fbf19e345a567642b9cdfef158691f4d6
Author: Simon McVittie <smcv collabora com>
Date:   Thu Jan 28 21:03:55 2021 +0000

    error test: Don't test programmer error under AddressSanitizer
    
    ASan's vasprintf() is less forgiving than glibc's.
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 glib/tests/error.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/glib/tests/error.c b/glib/tests/error.c
index 4f4c6b3c7..a002e46cb 100644
--- a/glib/tests/error.c
+++ b/glib/tests/error.c
@@ -1,5 +1,7 @@
 #include <glib.h>
 
+#include "glib-private.h"
+
 static void
 test_overwrite (void)
 {
@@ -100,11 +102,12 @@ static void
 test_new_valist_invalid_va (gpointer dummy,
                          ...)
 {
-#ifdef __linux__
+#if defined(__linux__) && !defined(_GLIB_ADDRESS_SANITIZER)
   /* Only worth testing this on Linux; if other platforms regress on this legacy
    * behaviour, we don’t care. In particular, calling g_error_new_valist() with
    * a %NULL format will crash on FreeBSD as its implementation of vasprintf()
-   * is less forgiving than Linux’s. That’s fine: it’s a programmer error in
+   * is less forgiving than Linux’s. Similarly, AddressSanitizer deliberately
+   * crashes when given a %NULL format. That’s fine: it’s a programmer error in
    * either case. */
   const struct
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]