Hi Sujal, Thanks for the patch, merged.
Aaron On Thu, Nov 5, 2026 at 3:33 AM Sujal Tuladhar <[email protected]> wrote: > > Hi, > > The attached patch fixes a NULL pointer dereference in eu-readelf's > print_debug_units when printing a .debug_types section for which libdw has no > section data. > > For .debug_types, print_debug_units builds a fake Dwarf_CU ending at > sectiondata[IDX_debug_info]->d_size so that dwarf_get_units moves on to the > first type unit. When dwfl_module_getdwarf fails, readelf uses its zeroed > dummy_dbg and still prints any section named .debug_types, so this > dereferences NULL; libdw also accepts .debug_types with .debug_line but no > .debug_info. The patch returns through the existing cleanup when there is no > .debug_types data, and starts the fake CU at the beginning of .debug_types > when there is no .debug_info. > > Reproducible with eu-readelf --debug-dump=info on a crafted ELF with a > .debug_types section that libdw cannot load; ASAN reports a SEGV on address > 0x10 in print_debug_units. The patch (git format-patch, applies on HEAD > 10b728d8) is attached. I can send the reproducer file, or add it as a test > case, if that helps. > > Thanks, > Sujal Tuladhar
