[PATCH] libelf: Only fetch shdr once in elf_compress[_gnu]
Aaron Merey
amerey@redhat.com
Thu Nov 7 15:18:27 GMT 2024
Hi Mark,
On Wed, Nov 6, 2024 at 2:13 PM Mark Wielaard <mark@klomp.org> wrote:
>
> Some compilers assume the second call to elf[32|64]_getshdr can fail
> and produce error: potential null pointer dereference. Just store the
> result of the first call and reuse (when not NULL).
>
> * libelf/elf_compress.c (elf_compress): Store getshdr result in
> a shdr union var.
> * libelf/elf_compress_gnu.c (): Likewise
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=32311
>
> Signed-off-by: Mark Wielaard <mark@klomp.org>
> ---
> libelf/elf_compress.c | 55 +++++++++++++++++++++------------------
> libelf/elf_compress_gnu.c | 45 ++++++++++++++------------------
> 2 files changed, 48 insertions(+), 52 deletions(-)
LGTM.
Aaron
More information about the Elfutils-devel
mailing list