aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-03-17 17:49:12 +1030
committerAlan Modra <amodra@gmail.com>2018-03-21 21:42:17 +1030
commit675e28092f9d92c56c38d40d13ad5b766bdede05 (patch)
tree50e41146bc1489f10fc2e676b24beba579bc3fe3 /bfd/elf32-ppc.c
parentdca9fbc845f297db70dcb2202624b1497df5593c (diff)
downloadgdb-675e28092f9d92c56c38d40d13ad5b766bdede05.zip
gdb-675e28092f9d92c56c38d40d13ad5b766bdede05.tar.gz
gdb-675e28092f9d92c56c38d40d13ad5b766bdede05.tar.bz2
Don't exceed reloc array bounds
* elf64-ppc.c (ppc64_elf_relocate_section): Don't access rel[1] without first checking array bounds. * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 66bbf0d..182dc2a 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -8000,7 +8000,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
break;
case R_PPC_TLSGD:
- if ((tls_mask & TLS_TLS) != 0 && (tls_mask & TLS_GD) == 0)
+ if ((tls_mask & TLS_TLS) != 0 && (tls_mask & TLS_GD) == 0
+ && rel + 1 < relend)
{
unsigned int insn2;
bfd_vma offset = rel->r_offset;
@@ -8027,7 +8028,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
break;
case R_PPC_TLSLD:
- if ((tls_mask & TLS_TLS) != 0 && (tls_mask & TLS_LD) == 0)
+ if ((tls_mask & TLS_TLS) != 0 && (tls_mask & TLS_LD) == 0
+ && rel + 1 < relend)
{
unsigned int insn2;