[PATCH v2] libstdc++: fix a dangling reference crash in ranges::is_permutation

Giuseppe D'Angelo giuseppe.dangelo@kdab.com
Fri Dec 20 19:33:42 GMT 2024


Hello,

On 20/12/2024 13:23, Giuseppe D'Angelo wrote:
> 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?
Better patch attached.

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: 3066 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20241220/c37d87e1/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/c37d87e1/attachment.p7s>


More information about the Libstdc++ mailing list