aboutsummaryrefslogtreecommitdiff
path: root/bfd/aoutx.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-12-02 16:41:14 +0000
committerNick Clifton <nickc@redhat.com>2016-12-02 16:41:14 +0000
commit531336e3a0b79ed60cfc36ad2d6579b6a71175da (patch)
treef8ed9fd8bbeb6fb51e31e7ac6af7640dbe5a5e62 /bfd/aoutx.h
parent0c1b455e294c6debb4efedc7f1346f3c43249f15 (diff)
downloadgdb-531336e3a0b79ed60cfc36ad2d6579b6a71175da.zip
gdb-531336e3a0b79ed60cfc36ad2d6579b6a71175da.tar.gz
gdb-531336e3a0b79ed60cfc36ad2d6579b6a71175da.tar.bz2
Fix seg-fault in the linker when examining a corrupt binary.
PR ld/20909 * aoutx.h (aout_link_add_symbols): Fix off-by-one error in check for an illegal string offset.
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r--bfd/aoutx.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 4308679..b9ac2b7 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -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;