https://sourceware.org/bugzilla/show_bug.cgi?id=32656
Mark Wielaard <mark at klomp dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2025-02-08 CC| |mark at klomp dot org Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at sourceware dot org |mark at klomp dot org --- Comment #1 from Mark Wielaard <mark at klomp dot org> --- Replicated using valgrind and eu-readelf -x 6 -z ==742249== Invalid read of size 1 ==742249== at 0x484BB30: strncmp (vg_replace_strmem.c:717) ==742249== by 0x401D2A: startswith (system.h:118) ==742249== by 0x429F8C: dump_data_section (readelf.c:13329) ==742249== by 0x42A68B: for_each_section_argument (readelf.c:13457) ==742249== by 0x42A7F8: dump_data (readelf.c:13487) ==742249== by 0x404645: process_elf_file (readelf.c:1080) ==742249== by 0x403C06: process_dwflmod (readelf.c:840) ==742249== by 0x48BD942: dwfl_getmodules (dwfl_getmodules.c:86) ==742249== by 0x40403A: process_file (readelf.c:948) ==742249== by 0x402B55: main (readelf.c:417) ==742249== Address 0x0 is not stack'd, malloc'd or (recently) free'd The issue simply is that when specifying the section to dump with a number/index and it doesn't have a name the .zdebug check fails. The fix is simple: diff --git a/src/readelf.c b/src/readelf.c index 3991cda81df2..576b193b092d 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -13326,7 +13326,7 @@ dump_data_section (Elf_Scn *scn, const GElf_Shdr *shdr, const char *name) _("Couldn't uncompress section"), elf_ndxscn (scn)); } - else if (startswith (name, ".zdebug")) + else if (name && startswith (name, ".zdebug")) { if (elf_compress_gnu (scn, 0, 0) < 0) printf ("WARNING: %s [%zd]\n", Introduced when -z support was added in commit b7105b40ccd7 ("readelf: Add -z,--decompress option.") -- You are receiving this mail because: You are on the CC list for the bug.