[PATCH] libstdc++: fix a dangling reference crash in ranges::is_permutation
Giuseppe D'Angelo
giuseppe.dangelo@kdab.com
Fri Dec 20 12:23:02 GMT 2024
Hi,
The implementation of ranges::is_permutation may create a dangling
reference, which then results (sometimes) in a crash. A minimal example
that shows the problem under ASAN is https://gcc.godbolt.org/z/7bP9nE8fK
The attached patch fixes it. I've tested on Linux x86-64. Adding a
negative test for this is somehow challenging (how do you test you're
not using a dangling reference?), but running the modified test under
ASAN shows the fix in place.
Do you need me to create a report on bugzilla and cross-reference it
from the patch?
Thanks,
--
Giuseppe D'Angelo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libstdc-fix-a-dangling-reference-crash-in-ranges-is_.patch
Type: text/x-patch
Size: 2988 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20241220/6373effa/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4244 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20241220/6373effa/attachment.p7s>
More information about the Libstdc++
mailing list