aboutsummaryrefslogtreecommitdiff
path: root/stdlib/Makefile
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-11-21 16:45:35 +0100
committerFlorian Weimer <fweimer@redhat.com>2023-11-21 16:46:18 +0100
commit64e4acf24da15c11cb83f933947df3b2e8a700cd (patch)
treeb3d8e27747379f2b9e4007740f706a63225387f5 /stdlib/Makefile
parent55364e1f7dfab372f0710513c4d1c967c4965f71 (diff)
downloadglibc-64e4acf24da15c11cb83f933947df3b2e8a700cd.tar.xz
glibc-64e4acf24da15c11cb83f933947df3b2e8a700cd.zip
stdlib: The qsort implementation needs to use heapsort in more cases
The existing logic avoided internal stack overflow. To avoid a denial-of-service condition with adversarial input, it is necessary to fall over to heapsort if tail-recursing deeply, too, which does not result in a deep stack of pending partitions. The new test stdlib/tst-qsort5 is based on Douglas McIlroy's paper on this subject. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'stdlib/Makefile')
-rw-r--r--stdlib/Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 48688f6a27..6194d1cb22 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -215,6 +215,7 @@ tests := \
tst-qsort \
tst-qsort2 \
tst-qsort3 \
+ tst-qsort5 \
tst-quick_exit \
tst-rand48 \
tst-rand48-2 \
@@ -512,3 +513,5 @@ $(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3
'$(run-program-env)' '$(test-program-prefix-after-env)' \
$(common-objpfx)stdlib/; \
$(evaluate-test)
+
+$(objpfx)tst-qsort5: $(libm)