[binutils-gdb] XCOFF sanity check

Alan Modra amodra@sourceware.org
Mon Mar 27 11:29:15 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=58c4c6a0bf29525a029d64a6446ac5d9e0c45a4a

commit 58c4c6a0bf29525a029d64a6446ac5d9e0c45a4a
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Mar 25 09:43:40 2023 +1030

    XCOFF sanity check
    
            * coffcode.h (coff_pointerize_aux_hook): Sanity check
            x_csect.x_scnlen against raw_syment_count.

Diff:
---
 bfd/coffcode.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 7a4c409a756..bf55d83530d 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -2462,7 +2462,8 @@ coff_pointerize_aux_hook (bfd *abfd ATTRIBUTE_UNUSED,
       && indaux + 1 == symbol->u.syment.n_numaux)
     {
       BFD_ASSERT (! aux->is_sym);
-      if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) == XTY_LD)
+      if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) == XTY_LD
+	  && (bfd_vma) aux->u.auxent.x_csect.x_scnlen.l < obj_raw_syment_count (abfd))
 	{
 	  aux->u.auxent.x_csect.x_scnlen.p =
 	    table_base + aux->u.auxent.x_csect.x_scnlen.l;


More information about the Binutils-cvs mailing list