News for hackers. Stuff that matters.
Re:Out-of-bounds read and write in the glibc's qsort() by ack_complete on Monday February 05, 2024 @03:05PM (#39266368)
The situation is not any different for std::sort, which also requires that the supplied comparison operator be well-behaved and can also fail in the same way otherwise.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41448

Re:Out-of-bounds read and write in the glibc's qsort() by microtherion on Monday February 05, 2024 @05:11PM (#39267957)
In fact if an implementation of std::sort has this bug, it's worse, because a fix in a template function requires recompiling all clients to go into effect, while qsort can be fixed in one shared library.
Re:Out-of-bounds read and write in the glibc's qsort() by ComputerGuru on Monday February 05, 2024 @03:12PM (#39266458)
Never mind, you're right of course. I blanked for a moment there and completely forgot that you just need to use `std::stable_sort()` for non-deterministic comparison routines.