]> Git Repo - binutils.git/commitdiff
bfd/elf-attrs.c: Fix possible infinite loop parsing attributes
authorWill Newton <[email protected]>
Wed, 5 Nov 2014 15:24:30 +0000 (15:24 +0000)
committerWill Newton <[email protected]>
Thu, 6 Nov 2014 13:01:18 +0000 (13:01 +0000)
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.

bfd/ChangeLog
bfd/elf-attrs.c

index 16724b3cb52b5acac06d5efdd976eb2849284c35..7a57b1265f99207e6e5423728566b62472b792e9 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-06  Will Newton  <[email protected]>
+
+       * elf-attrs.c (_bfd_elf_parse_attributes): Handle zero
+       length sections and sub-sections.
+
 2014-11-04  Nick Clifton  <[email protected]>
 
        PR binutils/17512
index cd0cbcaa5556afecc6559e4a3ed51372e0514833..6bc2944c7bffec0a31a60c3899a267582202ca24 100644 (file)
@@ -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;
This page took 0.033324 seconds and 4 git commands to generate.