[clang] [compiler-rt] [ASan] Document define to disable container overflow checks at compile time. (PR #163468)
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 14 17:30:24 PDT 2025
================
@@ -7,55 +7,72 @@
// RUN: %env_asan_opts=detect_container_overflow=0 %run %t crash
//
// Test crash due to __sanitizer_annotate_contiguous_container.
+//
+// Test with -D__ASAN_DISABLE_CONTAINER_OVERFLOW__ flag - should not crash
+// RUN: %clangxx_asan -D__ASAN_DISABLE_CONTAINER_OVERFLOW__ -O %s -o %t-no-overflow
+// RUN: %run %t-no-overflow crash
+// RUN: %run %t-no-overflow bad-bounds
+// RUN: %run %t-no-overflow unaligned-bad-bounds
+// RUN: %run %t-no-overflow odd-alignment
+// RUN: %run %t-no-overflow odd-alignment-end
+//
+// Test overflow checks can be disabled
#include <assert.h>
#include <string.h>
-extern "C" {
-void __sanitizer_annotate_contiguous_container(const void *beg, const void *end,
- const void *old_mid,
- const void *new_mid);
-} // extern "C"
+// public definition of __sanitizer_annotate_contiguous_container
+#include "sanitizer/common_interface_defs.h"
----------------
vitalybuka wrote:
I don't understand the test change.
Patch changes only the text of the hint, but nothing here checks for the message.
I suggest reverting this test, and create a new trivial test just to trigger the message.
Having this patch without a test is also LGTM.
https://github.com/llvm/llvm-project/pull/163468
More information about the cfe-commits
mailing list