Skip to content

Test PR for a test, please ignore #101349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions compiler-rt/test/asan/TestCases/contiguous_container_crash.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %clangxx_asan -O %s -o %t
// RUN: not %run %t crash 2>&1 | FileCheck --check-prefix=CHECK-CRASH %s
// RUN: not %run %t bad-bounds 2>&1 | FileCheck --check-prefix=CHECK-BAD-BOUNDS %s
// RUN: not %run %t unaligned-bad-bounds 2>&1 | FileCheck --check-prefix=CHECK-UNALIGNED-BAD-BOUNDS %s --implicit-check-not="beg is not aligned by"
// RUN: not %run %t odd-alignment 2>&1 | FileCheck --check-prefix=CHECK-CRASH %s
// RUN: not %run %t odd-alignment-end 2>&1 | FileCheck --check-prefix=CHECK-CRASH %s
// RUN: %env_asan_opts=detect_container_overflow=0 %run %t crash
Expand Down Expand Up @@ -35,6 +36,13 @@ void BadBounds() {
&t[0] + 50);
}

void UnalignedBadBounds() {
char t[100];
// CHECK-UNALIGNED-BAD-BOUNDS: ERROR: AddressSanitizer: bad parameters to __sanitizer_annotate_contiguous_container
__sanitizer_annotate_contiguous_container(&t[1], &t[0] + 100, &t[0] + 101,
&t[0] + 50);
}

int OddAlignment() {
int t[100];
t[60] = 0;
Expand All @@ -57,6 +65,8 @@ int main(int argc, char **argv) {
return TestCrash();
else if (!strcmp(argv[1], "bad-bounds"))
BadBounds();
else if (!strcmp(argv[1], "unaligned-bad-bounds"))
UnalignedBadBounds();
else if (!strcmp(argv[1], "odd-alignment"))
return OddAlignment();
else if (!strcmp(argv[1], "odd-alignment-end"))
Expand Down