[libcxx-commits] [libcxx] [libc++] Add input validation for set_intersection() in debug mode. (PR #101508)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 12 08:11:20 PST 2024
================
@@ -96,6 +99,12 @@ __set_intersection(
_Compare&& __comp,
std::forward_iterator_tag,
std::forward_iterator_tag) {
+#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
+ _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
----------------
ldionne wrote:
This patch should also add tests to trigger these assertions. You can see an example of how that's done in e.g. `libcxx/test/libcxx/algorithms/alg.sorting/assert.min.max.pass.cpp`. You should be able to just purposefully call the algorithm with something that's badly sorted.
https://github.com/llvm/llvm-project/pull/101508
More information about the libcxx-commits
mailing list