[libcxx-commits] [libcxx] [libc++][hardening] Add `_LIBCPP_ASSERT_NON_NULL` to check for null pointers (PR #71428)
Konstantin Varlamov via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 7 18:02:56 PST 2023
================
@@ -258,6 +258,10 @@
// a non-existent element. For iterator checks to work, bounded iterators must be enabled in the ABI. Types like
// `optional` and `function` are considered one-element containers for the purposes of this check.
//
+// - `_LIBCPP_ASSERT_NON_NULL` -- checks that the pointer being dereferenced is not null. On most modern platforms zero
+// address does not refer to an actual location in memory, so a null pointer dereference would not compromize the
+// memory security of a program.
----------------
var-const wrote:
How about `(however, it is still undefined behavior that can manifest itself via compiler optimizations)`?
https://github.com/llvm/llvm-project/pull/71428
More information about the libcxx-commits
mailing list