[libcxx-commits] [libcxx] [libc++][hardening] Add `_LIBCPP_ASSERT_NON_NULL` to check for null pointers (PR #71428)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 6 23:03:15 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.
----------------
ldionne wrote:

```suggestion
//   memory security of a program, but it's still technically UB to do that.
```

https://github.com/llvm/llvm-project/pull/71428


More information about the libcxx-commits mailing list