diff options
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf-attrs.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 16724b3..7a57b12 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2014-11-06 Will Newton <will.newton@linaro.org> + + * elf-attrs.c (_bfd_elf_parse_attributes): Handle zero + length sections and sub-sections. + 2014-11-04 Nick Clifton <nickc@redhat.com> PR binutils/17512 diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c index cd0cbca..6bc2944 100644 --- a/bfd/elf-attrs.c +++ b/bfd/elf-attrs.c @@ -455,6 +455,8 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) section_len = bfd_get_32 (abfd, p); p += 4; + if (section_len == 0) + break; if (section_len > len) section_len = len; len -= section_len; @@ -487,6 +489,8 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) 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; |