aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-06-21 11:13:49 +0100
committerNick Clifton <nickc@redhat.com>2017-06-21 11:13:49 +0100
commitcb06d03ad92ffcfaa09c3f065837cb39e9e1486d (patch)
tree458bb2fbf265d7c727cbd9dc027ff4aa794bc621 /bfd
parentc458d0079cc5e8ff29256355e6532ad2f96a8aa6 (diff)
downloadgdb-cb06d03ad92ffcfaa09c3f065837cb39e9e1486d.zip
gdb-cb06d03ad92ffcfaa09c3f065837cb39e9e1486d.tar.gz
gdb-cb06d03ad92ffcfaa09c3f065837cb39e9e1486d.tar.bz2
Fix address violation parsing a corrupt IEEE Alpha binary.
PR binutils/21637 * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section list. (image_set_ptr): Likewise. (alpha_vms_fix_sec_rel): Likewise. (alpha_vms_slurp_relocs): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/vms-alpha.c27
2 files changed, 32 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9e1cb05..8edcbc2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,14 @@
2017-06-21 Nick Clifton <nickc@redhat.com>
+ PR binutils/21637
+ * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section
+ list.
+ (image_set_ptr): Likewise.
+ (alpha_vms_fix_sec_rel): Likewise.
+ (alpha_vms_slurp_relocs): Likewise.
+
+2017-06-21 Nick Clifton <nickc@redhat.com>
+
PR binutils/21633
* ieee.c (ieee_slurp_sections): Check for a NULL return from
read_id.
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 8569868..aa38de9 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -1282,6 +1282,8 @@ _bfd_vms_slurp_egsd (bfd *abfd)
struct vms_esdf *esdf = (struct vms_esdf *)vms_rec;
entry->value = bfd_getl64 (esdf->value);
+ if (PRIV (sections) == NULL)
+ return FALSE;
entry->section = PRIV (sections)[bfd_getl32 (esdf->psindx)];
if (old_flags & EGSY__V_NORM)
@@ -1316,7 +1318,11 @@ _bfd_vms_slurp_egsd (bfd *abfd)
entry->symbol_vector = bfd_getl32 (egst->value);
if (old_flags & EGSY__V_REL)
- entry->section = PRIV (sections)[bfd_getl32 (egst->psindx)];
+ {
+ if (PRIV (sections) == NULL)
+ return FALSE;
+ entry->section = PRIV (sections)[bfd_getl32 (egst->psindx)];
+ }
else
entry->section = bfd_abs_section_ptr;
@@ -1404,6 +1410,8 @@ image_set_ptr (bfd *abfd, bfd_vma vma, int sect, struct bfd_link_info *info)
vms_debug2 ((4, "image_set_ptr (0x%08x, sect=%d)\n", (unsigned)vma, sect));
+ if (PRIV (sections) == NULL)
+ return;
sec = PRIV (sections)[sect];
if (info)
@@ -1726,7 +1734,12 @@ static bfd_vma
alpha_vms_fix_sec_rel (bfd *abfd, struct bfd_link_info *info,
unsigned int rel, bfd_vma vma)
{
- asection *sec = PRIV (sections)[rel & RELC_MASK];
+ asection *sec;
+
+ if (PRIV (sections) == NULL)
+ return 0;
+
+ sec = PRIV (sections)[rel & RELC_MASK];
if (info)
{
@@ -5061,6 +5074,8 @@ alpha_vms_slurp_relocs (bfd *abfd)
return FALSE;
}
+ if (PRIV (sections) == NULL)
+ return FALSE;
sec = PRIV (sections)[cur_psect];
if (sec == bfd_abs_section_ptr)
{
@@ -5119,8 +5134,12 @@ alpha_vms_slurp_relocs (bfd *abfd)
reloc->sym_ptr_ptr = sym;
}
else if (cur_psidx >= 0)
- reloc->sym_ptr_ptr =
- PRIV (sections)[cur_psidx]->symbol_ptr_ptr;
+ {
+ if (PRIV (sections) == NULL)
+ return FALSE;
+ reloc->sym_ptr_ptr =
+ PRIV (sections)[cur_psidx]->symbol_ptr_ptr;
+ }
else
reloc->sym_ptr_ptr = NULL;