[libcxx-commits] [libcxx] [libc++] Add assertions for potential OOB reads in std::nth_element (PR #67023)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 27 06:43:45 PDT 2023


================
@@ -165,6 +175,39 @@ void check_oob_sort_read() {
     }
 }
 
+void check_oob_nth_element_read() {
----------------
ldionne wrote:

I can't comment on it due to the Github review UI, but there's a line above in this file with:

```
std::nth_element(copy.begin(), copy.end(), copy.end(), checked_predicate); // doesn't go OOB even with invalid comparator
```

I think we should remove that part of the test above since clearly it's not that `nth_element` was not affected, it's just that the specific values I used didn't trigger the issue.

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


More information about the libcxx-commits mailing list