[PATCH] libasm: Fix use-after-free issue with circular single linked list cleanup
Mark Wielaard
mark@klomp.org
Tue Feb 21 12:22:00 GMT 2023
Hi,
On Fri, 2023-02-17 at 15:00 +0100, Mark Wielaard wrote:
> Pointed out by gcc 12 with -Wuse-after-free=3
>
> In function ‘free_section’
> asm_end.c:552:17: error: pointer ‘data’ used after ‘free’ [-Werror=use-after-free]
> 552 | while (oldp != scnp->content);
> | ~~~~~^~~~~~~~~~~~~~~~
> asm_end.c:550:9: note: call to ‘free’ here
> 550 | free (oldp);
> | ^~~~~~~~~~~
>
> Fix by freeing scnp->content last.
I pushed this and also committed the attached patch that adds -Wuse-
after-free=3 if the compiler supports it.
Cheers,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-configure-Check-for-and-Wuse-after-free-3-when-avail.patch
Type: text/x-patch
Size: 3425 bytes
Desc:
URL: <https://sourceware.org/pipermail/elfutils-devel/attachments/20230221/5111fb23/attachment.bin>
More information about the Elfutils-devel
mailing list