gnu/gcc/0bcb57a2294fbadfa8388bdc3a5be356ad3cf91c libstdc++: Validate user-provided stride values for layout_stride.
Converting the __strides values using __index_type_cast asserts
that they are non-negative and each value is representable as
index_type.
libstdc++-v3/ChangeLog:
* include/std/mdspan
(layout_stride::mapping::mapping(const extent_type&, span<...>)):
Convert strides using __index_type_cast, which bring asserts
for negative and unrepresentable values.
* testsuite/23_containers/mdspan/layouts/stride_neg.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 files changed