[libcxx-commits] [libcxx] [libc++] Add missing assertion in std::span constructor (PR #118396)

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 4 12:16:12 PST 2024


var-const wrote:

> Just a drive by comment, but can this assert be some form of _LIBCPP_ASSERT_NON_NULL?
> 
> I'm not sure if passing a null-iterator here with a length has a lot of security impact (besides the general idea that it's UB and the compiler can do anything). It's possible I'm misunderstanding :)

It won't necessarily lead to a null-pointer dereference (the invalid span can be called with a non-zero index later on) -- I'd keep the `non-null` category specifically for dereferencing null.

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


More information about the libcxx-commits mailing list