[Bug libelf/32311] elf_compress_gnu.c: gcc warns null-dereference with lto

mark at klomp dot org sourceware-bugzilla@sourceware.org
Thu Nov 7 15:32:15 GMT 2024


https://sourceware.org/bugzilla/show_bug.cgi?id=32311

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Mark Wielaard <mark at klomp dot org> ---
commit 8707194a9f2f0b13e53041b03ebfdbdbd2942e43
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue Nov 5 23:31:14 2024 +0100

    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>

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Elfutils-devel mailing list