Fix seg-fault in the linker when examining a corrupt binary.
authorNick Clifton <nickc@redhat.com>
Fri, 2 Dec 2016 16:41:14 +0000 (16:41 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 2 Dec 2016 16:41:14 +0000 (16:41 +0000)
PR ld/20909
* aoutx.h (aout_link_add_symbols): Fix off-by-one error in check
for an illegal string offset.

bfd/ChangeLog
bfd/aoutx.h

index d061e66a2609f875ff444c6b5bf64675f03cc435..c8085e7b42c79619b59daf2d3bc37eabb70c318d 100644 (file)
@@ -1,3 +1,9 @@
+2016-12-02  Nick Clifton  <nickc@redhat.com>
+
+       PR ld/20909
+       * aoutx.h (aout_link_add_symbols): Fix off-by-one error in check
+       for an illegal string offset.
+
 2016-12-02  Gary Benson  <gbenson@redhat.com>
 
        * elf.c (_bfd_elf_make_section_from_shdr): Pass offset to
index 4308679207d4b0d16892b8c1cefe94b98f050edd..b9ac2b7f9e56051e1aa9d87bf4a12ba6e736d65d 100644 (file)
@@ -3031,10 +3031,9 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
        continue;
 
       /* PR 19629: Corrupt binaries can contain illegal string offsets.  */
-      if (GET_WORD (abfd, p->e_strx) > obj_aout_external_string_size (abfd))
+      if (GET_WORD (abfd, p->e_strx) >= obj_aout_external_string_size (abfd))
        return FALSE;
       name = strings + GET_WORD (abfd, p->e_strx);
-      
       value = GET_WORD (abfd, p->e_value);
       flags = BSF_GLOBAL;
       string = NULL;
This page took 0.031621 seconds and 4 git commands to generate.