Work around another self-comparison application issue in qsort (#2248502)

This commit is contained in:
Florian Weimer 2023-11-15 07:31:04 +01:00
parent 7d7642221f
commit 9e361d1258
2 changed files with 27 additions and 1 deletions

22
glibc-rh2248502-3.patch Normal file
View File

@ -0,0 +1,22 @@
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Nov 15 06:31:40 2023 +0100
stdlib: Avoid another self-comparison in qsort
In the insertion phase, we could run off the start of the array if the
comparison function never runs zero. In that case, it never finds the
initial element that terminates the iteration.
diff --git a/stdlib/qsort.c b/stdlib/qsort.c
index ad110e8a892a66e1..1ea31ff4247da7a4 100644
--- a/stdlib/qsort.c
+++ b/stdlib/qsort.c
@@ -217,7 +217,7 @@ insertion_sort_qsort_partitions (void *const pbase, size_t total_elems,
while ((run_ptr += size) <= end_ptr)
{
tmp_ptr = run_ptr - size;
- while (cmp (run_ptr, tmp_ptr, arg) < 0)
+ while (tmp_ptr != base_ptr && cmp (run_ptr, tmp_ptr, arg) < 0)
tmp_ptr -= size;
tmp_ptr += size;

View File

@ -159,7 +159,7 @@ Version: %{glibcversion}
# - It allows using the Release number without the %%dist tag in the dependency
# generator to make the generated requires interchangeable between Rawhide
# and ELN (.elnYY < .fcXX).
%global baserelease 21
%global baserelease 22
Release: %{baserelease}%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
@ -233,6 +233,7 @@ Patch23: glibc-python3.patch
Patch24: glibc-rh2244688.patch
Patch25: glibc-rh2244992.patch
Patch26: glibc-rh2248915.patch
Patch27: glibc-rh2248502-3.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2203,6 +2204,9 @@ update_gconv_modules_cache ()
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Wed Nov 15 2023 Florian Weimer <fweimer@redhat.com> - 2.38.9000-22
- Work around another self-comparison application issue in qsort (#2248502)
* Sat Nov 11 2023 Florian Weimer <fweimer@redhat.com> - 2.38.9000-21
- Fix missing entries in /etc/ld.so.cache (#2248915)