diff options
author | Alan Modra <amodra@gmail.com> | 2025-09-08 08:40:03 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2025-09-08 22:17:47 +0930 |
commit | 58b625a9c9ee7780a622d8082abf936ac9514a0c (patch) | |
tree | f068dfc4d7c05e31713d2dc10ca8d6c260e71822 | |
parent | 62e6979095ab19728ca3f2f86f98e8edb8f33cc8 (diff) | |
download | binutils-58b625a9c9ee7780a622d8082abf936ac9514a0c.zip binutils-58b625a9c9ee7780a622d8082abf936ac9514a0c.tar.gz binutils-58b625a9c9ee7780a622d8082abf936ac9514a0c.tar.bz2 |
vms-alpha: sections array index sanity checks
Adds a couple of missing bound checks.
* vms-alpha.c (alpha_vms_fix_sec_rel): Sanity check relocation
section index.
(alpha_vms_bfd_final_link): Assert that section index is sane.
-rw-r--r-- | bfd/vms-alpha.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index f8eaf6f..36cdac6 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -1863,11 +1863,16 @@ alpha_vms_fix_sec_rel (bfd *abfd, struct bfd_link_info *info, unsigned int rel, bfd_vma vma) { asection *sec; + unsigned int sec_indx; if (PRIV (sections) == NULL) return 0; - sec = PRIV (sections)[rel & RELC_MASK]; + sec_indx = rel & RELC_MASK; + if (sec_indx >= PRIV (section_count)) + return 0; + + sec = PRIV (sections)[sec_indx]; if (info) { @@ -9655,6 +9660,7 @@ alpha_vms_bfd_final_link (bfd *abfd, struct bfd_link_info *info) bfd_vma tfradr = PRIV2 (startbfd, eom_data).eom_l_tfradr; asection *sec; + BFD_ASSERT (ps_idx < PRIV2 (startbfd, section_count)); sec = PRIV2 (startbfd, sections)[ps_idx]; bfd_set_start_address |