diff options
author | Alan Modra <amodra@gmail.com> | 2021-07-30 12:58:12 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-07-30 15:08:55 +0930 |
commit | 5cfe19e51ee06feb191b33a934bcf6cfaaace7b1 (patch) | |
tree | 1a42267c12b11f94e66e1cf5141b4ffd8fae25c5 /bfd/elf.c | |
parent | 472dd8b357e878b09ffa0703ad80b2915aaa4ec6 (diff) | |
download | binutils-5cfe19e51ee06feb191b33a934bcf6cfaaace7b1.zip binutils-5cfe19e51ee06feb191b33a934bcf6cfaaace7b1.tar.gz binutils-5cfe19e51ee06feb191b33a934bcf6cfaaace7b1.tar.bz2 |
reloc_upper_bound size calculations
Section reloc_count is an unsigned int. Adding one for a NULL
terminator to an array of arelent pointers can wrap the count to
zero. Avoid that by doing the addition as longs.
* coffgen.c (coff_get_reloc_upper_bound): Don't overflow unsigned
int expression.
* elf.c (_bfd_elf_get_reloc_upper_bound): Likewise.
* elf64-sparc.c (elf64_sparc_get_reloc_upper_bound): Likewise.
* mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
* vms-alpha.c (alpha_vms_get_reloc_upper_bound): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -8559,7 +8559,7 @@ _bfd_elf_get_reloc_upper_bound (bfd *abfd, sec_ptr asect) return -1; } #endif - return (asect->reloc_count + 1) * sizeof (arelent *); + return (asect->reloc_count + 1L) * sizeof (arelent *); } /* Canonicalize the relocs. */ |