PR28401, invalid section name lookup
authorAlan Modra <amodra@gmail.com>
Tue, 5 Oct 2021 23:24:56 +0000 (09:54 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 6 Oct 2021 00:54:29 +0000 (11:24 +1030)
commit55e3926e79937da55da3eaad3b15b4c099071976
tree74d5010cece6e8cb4cde5c92d70acc0c090ba6ef
parent79fa3c401c650521ff771f86810597dd3d3bf75c
PR28401, invalid section name lookup

The PR28401 testcase has a section named "", ie. an empty string.
This results in some silly behaviour in load_debug_section, and
dump_dwarf_section.  Fix that.  Note that this patch doesn't correct
the main complaint in PR28401, "failed to allocate", since malloc
failures on sections having huge bogus sizes are to be expected.  We
can't safely catch all such cases by comparing with file size, for
example, where sections contain compressed data.

PR 28401
* objdump.c (load_debug_section): Don't attempt to retrieve
empty name sections.
(dump_dwarf_section): Likewise.
binutils/objdump.c