The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=26a1180cd1521e4c438ac95a57b134e27ea0a72d
commit 26a1180cd1521e4c438ac95a57b134e27ea0a72d Author: Faraz Vahedi <[email protected]> AuthorDate: 2026-06-02 09:12:59 +0000 Commit: Robert Clausecker <[email protected]> CommitDate: 2026-06-07 20:59:19 +0000 qsort.3: Document mergesort() behaviour on size overflow Signed-off-by: Faraz Vahedi <[email protected]> Pull Request: https://github.com/freebsd/freebsd-src/pull/2243 Reviewed by: fuz MFC after: 1 week --- lib/libc/stdlib/qsort.3 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/libc/stdlib/qsort.3 b/lib/libc/stdlib/qsort.3 index e2e29e7cf04f..6b09d57524bf 100644 --- a/lib/libc/stdlib/qsort.3 +++ b/lib/libc/stdlib/qsort.3 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 25, 2024 +.Dd June 2, 2026 .Dt QSORT 3 .Os .Sh NAME @@ -362,13 +362,21 @@ functions succeed unless: .It Bq Er EINVAL The .Fa size -argument is zero, or, +argument is zero, the .Fa size argument to .Fn mergesort is less than -.Dq "sizeof(void *) / 2" . +.Dq "sizeof(void *) / 2" , +or +the +.Fa nmemb +and +.Fa size +arguments to +.Fn mergesort +describe an unrepresentable buffer size. .It Bq Er ENOMEM The .Fn heapsort
