]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: Only fetch shdr once in elf_compress[_gnu]
authorMark Wielaard <mark@klomp.org>
Tue, 5 Nov 2024 22:31:14 +0000 (23:31 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 7 Nov 2024 15:29:59 +0000 (16:29 +0100)
commit8707194a9f2f0b13e53041b03ebfdbdbd2942e43
treebb9b0319e418d7e6fd6e5a5409aca91b85a25ff9
parente425a70469436c704e6c24dd4bc2abb8fb24b61d
libelf: Only fetch shdr once in elf_compress[_gnu]

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
libelf/elf_compress_gnu.c