Skip to content
Commit 64e4acf2 authored by Florian Weimer's avatar Florian Weimer
Browse files

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: default avatarAdhemerval Zanella <adhemerval.zanella@linaro.org>
parent 55364e1f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment