[libc-commits] [libc] [libc] Expand usage of libc null checks. (PR #116262)
Aly ElAshram via libc-commits
libc-commits at lists.llvm.org
Wed Dec 18 12:49:48 PST 2024
AlyElashram wrote:
Hey @nickdesaulniers , I'm done with the changes however I'm currently creating unit tests to check that the functions segfault correctly. I'm failing to catch the segfault gracefully. Here's my current implementation which segfaults and coredumps for the `memchr.cpp` function.
```
#include "hdr/signal_macros.h"
TEST(LlvmLibcMemChrTest, CrashOnNullPtr) {
LIBC_NAMESPACE::memchr(nullptr, 1, 1);
}
```
I tried the `ASSERT_DEATH(LIBC_NAMESPACE::memchr(nullptr,1,1), WITH_SIGNAL(SIGSEGV));` macro but it causes linking errors.
https://github.com/llvm/llvm-project/pull/116262
More information about the libc-commits
mailing list