Handle the case of a zero length section or sub-section in
_bfd_elf_parse_attributes and in doing so prevent an infinite loop
in the parser.
bfd/ChangeLog:
2014-11-06 Will Newton <
[email protected]>
* elf-attrs.c (_bfd_elf_parse_attributes): Handle zero
length sections and sub-sections.
+
+ * elf-attrs.c (_bfd_elf_parse_attributes): Handle zero
+ length sections and sub-sections.
+
PR binutils/17512
section_len = bfd_get_32 (abfd, p);
p += 4;
+ if (section_len == 0)
+ break;
if (section_len > len)
section_len = len;
len -= section_len;
p += n;
subsection_len = bfd_get_32 (abfd, p);
p += 4;
+ if (subsection_len == 0)
+ break;
if (subsection_len > section_len)
subsection_len = section_len;
section_len -= subsection_len;