aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2023-11-04 22:48:27 +0100
committerhexcoder- <heiko@hexco.de>2023-11-04 22:48:27 +0100
commit6ed3f4cfac52d2bef60321bccb236c7c5d215404 (patch)
treeb09b954d4602165f78ac49b70721eaf6b047441a
parent8338844284a2a1f340d859e7b0871878537a0729 (diff)
downloadafl++-6ed3f4cfac52d2bef60321bccb236c7c5d215404.tar.gz
fix of fix: make sure ASAN_OPTIONS and LSAN_OPTIONS agree on leak detection
-rw-r--r--src/afl-common.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/afl-common.c b/src/afl-common.c
index 9ba7116d..65932e26 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -98,14 +98,16 @@ void set_sanitizer_defaults() {
}
/* LSAN does not support abort_on_error=1. (is this still true??) */
+ u8 should_detect_leaks = 0;
if (!have_lsan_options) {
u8 buf[2048] = "";
if (!have_san_options) { strcpy(buf, default_options); }
- if (have_san_options && NULL != strstr(have_asan_options, "detect_leaks=0")) {
- strcat(buf, "exitcode=" STRINGIFY(LSAN_ERROR) ":fast_unwind_on_malloc=0:print_suppressions=0:detect_leaks=0:malloc_context_size=30:");
+ if (have_asan_options && NULL != strstr(have_asan_options, "detect_leaks=0")) {
+ strcat(buf, "exitcode=" STRINGIFY(LSAN_ERROR) ":fast_unwind_on_malloc=0:print_suppressions=0:detect_leaks=0:malloc_context_size=0:");
} else {
+ should_detect_leaks = 1;
strcat(buf, "exitcode=" STRINGIFY(LSAN_ERROR) ":fast_unwind_on_malloc=0:print_suppressions=0:detect_leaks=1:malloc_context_size=30:");
}
@@ -117,7 +119,11 @@ void set_sanitizer_defaults() {
if (!have_lsan_options) {
- strcat(default_options, "detect_leaks=0:malloc_context_size=0:");
+ if (should_detect_leaks) {
+ strcat(default_options, "detect_leaks=1:malloc_context_size=30:");
+ } else {
+ strcat(default_options, "detect_leaks=0:malloc_context_size=0:");
+ }
}