[libc-commits] [libc] [libc] Expand usage of libc null checks. (PR #116262)
via libc-commits
libc-commits at lists.llvm.org
Wed Jan 8 13:31:20 PST 2025
================
@@ -26,3 +26,12 @@ TEST(LlvmLibcMempcpyTest, ZeroCount) {
void *result = LIBC_NAMESPACE::mempcpy(dest, src, 0);
ASSERT_EQ(static_cast<char *>(result), dest + 0);
}
+
+#if defined(LIBC_TARGET_OS_IS_LINUX)
+
+TEST(LlvmLibcMempcpyTest, CrashOnNullPtr) {
+ ASSERT_DEATH([]() { LIBC_NAMESPACE::mempcpy(nullptr, nullptr, 0); },
+ WITH_SIGNAL(SIGSEGV));
+}
+
+#endif // defined(LIBC_TARGET_OS_IS_LINUX)
----------------
lntue wrote:
nit: missing extra line at the end.
https://github.com/llvm/llvm-project/pull/116262
More information about the libc-commits
mailing list