DIE chains not ending with null entry

Mark Wielaard mjw at redhat.com
Wed Mar 9 14:59:06 UTC 2011


On Wed, 2011-03-09 at 15:18 +0100, Petr Machata wrote:
> Alas, the case that we see here is special:
> 
>   Dwarf_Die die_mem, *die = dwarf_offdie (dw, 0xab, &die_mem);
>   Dwarf_Die child;
>   dwarf_child (die, &child); // this actually passes
> 
> So libdw happily gives us a DIE that supposedly lies at 0xb1,
> interpreting the first bytes of .debug_abbrev as DIE.
> 
> I might turn that combination (empty chain + no null entry) into a hard
> error in dwarflint, but that seems rather convoluted.  I think this is
> something that should be fixed in libdw.  I've done that, the result is
> on the branch pmachata/dwarf_child_overrun.

That makes sense to me. dwarf_child () falls off the end of the
debug_info section, so should return an error.



More information about the elfutils-devel mailing list