Skip to content
Merged
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
15 changes: 0 additions & 15 deletions libc/test/src/compiler/stack_chk_guard_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,9 @@
//===----------------------------------------------------------------------===//

#include "hdr/signal_macros.h"
#include "src/__support/macros/sanitizer.h"
#include "src/compiler/__stack_chk_fail.h"
#include "src/string/memset.h"
#include "test/UnitTest/Test.h"

TEST(LlvmLibcStackChkFail, Death) {
EXPECT_DEATH([] { __stack_chk_fail(); }, WITH_SIGNAL(SIGABRT));
}

// Disable the test when asan is enabled so that it doesn't immediately fail
// after the memset, but before the stack canary is re-checked.
#ifndef LIBC_HAS_ADDRESS_SANITIZER
TEST(LlvmLibcStackChkFail, Smash) {
EXPECT_DEATH(
[] {
int arr[20];
LIBC_NAMESPACE::memset(arr, 0xAA, 2001);
},
WITH_SIGNAL(SIGABRT));
}
#endif // LIBC_HAS_ADDRESS_SANITIZER
Loading