diff --git a/README.md b/README.md
index 9e8418f48..b684b03f1 100644
--- a/README.md
+++ b/README.md
@@ -428,13 +428,6 @@ If things break or seem otherwise lackluster, **please** consult the
handy if you've got a reference to a valid nccell
anyway.
-
- I compiled with AddressSanitizer, and ASAN throws an exception on
- program exit.
- Yeah, I think it has something to do with our signal handling, don't know
- yet, sorry.
-
-
I ran my Notcurses program under valgrind
/ASAN, and
it shows memory leaks from libtinfo.so
, what's up with that?
diff --git a/src/lib/unixsig.c b/src/lib/unixsig.c
index 068ca1c34..8464b990b 100644
--- a/src/lib/unixsig.c
+++ b/src/lib/unixsig.c
@@ -205,6 +205,10 @@ int setup_signals(void* vnc, bool no_quit_sigs, bool no_winch_sigs,
handling_winch = true;
}
if(!no_quit_sigs){
+// AddressSanitizer doesn't want us to use sigaltstack(). we could force everyone
+// to export ASAN_OPTIONS=use_sigaltstack=0, or just not fuck with the alternate
+// signal stack when built with ASAN.
+#ifndef USE_ASAN
alt_signal_stack.ss_sp = malloc(alt_signal_stack.ss_size);
if(alt_signal_stack.ss_sp == NULL){
fprintf(stderr, "warning: couldn't create alternate signal stack (%s)" NL, strerror(errno));
@@ -217,6 +221,7 @@ int setup_signals(void* vnc, bool no_quit_sigs, bool no_winch_sigs,
alt_signal_stack.ss_sp = NULL;
}
}
+#endif
memset(&sa, 0, sizeof(sa));
fatal_callback = handler;
sa.sa_sigaction = fatal_handler;
diff --git a/tools/builddef.h.in b/tools/builddef.h.in
index 9c1bf5be6..19e3a3973 100644
--- a/tools/builddef.h.in
+++ b/tools/builddef.h.in
@@ -1,5 +1,10 @@
// Populated by CMake; not installed
+
+// if we're a DFSG build, we leave out references to certain demos
#cmakedefine DFSG_BUILD
+
+// if we're an ASAN build, we don't use sigaltstack() ourselves
+#cmakedefine USE_ASAN
#cmakedefine USE_DEFLATE
#cmakedefine USE_GPM
#cmakedefine USE_QRCODEGEN