Skip to content

Commit e9e6285

Browse files
committed
dwarf_loader: Skip empty CUs
Some parts are corrupt, and most are empty CUs, that were causing the segfault, now pahole doesn't crash and pdwtags, a debug utility that prints most dwarf tags, produces some output. [acme@quaco pahole]$ readelf -wi examples/asm/dw2-error.debug | grep -i corrupt readelf: examples/asm/dw2-error.debug: Warning: Invalid pointer size (0) in compunit header, using 4 instead readelf: examples/asm/dw2-error.debug: Warning: CU at offset 90 contains corrupt or unsupported version number: 153. [acme@quaco pahole]$ pahole examples/asm/dw2-error.debug [acme@quaco pahole]$ pdwtags examples/asm/dw2-error.debug /* Types: */ /* Functions: */ /* Variables: */ /* Types: */ /* 1 */ int /* size: 4 */ /* 2 */ /* tag__fprintf: const_type tag not supported! */; /* size: 4 */ /* Functions: */ /* Variables: */ const int _IO_stdin_used; /* size: 4 */ /* Types: */ /* Functions: */ /* Variables: */ [acme@quaco pahole]$ Reported-by: Tom de Vries Bugtracker: #9 (comment) Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 1abc001 commit e9e6285

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dwarf_loader.c

+3
Original file line numberDiff line numberDiff line change
@@ -2382,6 +2382,9 @@ static int cus__load_module(struct cus *cus, struct conf_load *conf,
23822382
Dwarf_Die die_mem;
23832383
Dwarf_Die *cu_die = dwarf_offdie(dw, off + cuhl, &die_mem);
23842384

2385+
if (cu_die == NULL)
2386+
break;
2387+
23852388
/*
23862389
* DW_AT_name in DW_TAG_compile_unit can be NULL, first
23872390
* seen in:

0 commit comments

Comments
 (0)