If a comparison called by forward_list::sort throws, the current
implementation can leave the list corrupted, which may cause a later
crash.

This patch restores valid links before allowing the same exception to
continue.  The element order remains unspecified, as permitted by the
standard, while iterators and references remain valid.

Tested on x86_64-pc-linux-gnu.

Thanks,
Odysseas

Attachment: PR124051.patch
Description: PR124051.patch

Reply via email to