Index: lib/sanitizer_common/sanitizer_posix.cc =================================================================== --- lib/sanitizer_common/sanitizer_posix.cc +++ lib/sanitizer_common/sanitizer_posix.cc @@ -271,7 +271,7 @@ /*offset*/0, /*filename*/0, /*filename_size*/0, /*protection*/0)) { CHECK_NE(0, end); - if (!IntervalsAreSeparate(start, end - 1, range_start, range_end)) + if (!IntervalsAreSeparate(start, end, range_start, range_end)) return false; } return true; Index: test/asan/TestCases/Darwin/empty-section.cc =================================================================== --- test/asan/TestCases/Darwin/empty-section.cc +++ test/asan/TestCases/Darwin/empty-section.cc @@ -0,0 +1,12 @@ +// Regression test with an empty (length = 0) custom section. + +// RUN: %clangxx_asan -g -O0 %s -c -o %t.o +// RUN: %clangxx_asan -g -O0 %t.o -o %t -sectcreate mysegment mysection /dev/null +// RUN: %run %t 2>&1 | FileCheck %s + +#include + +int main() { + printf("Hello, world!\n"); + // CHECK: Hello, world! +}