]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
reloc_upper_bound size calculations
authorAlan Modra <amodra@gmail.com>
Fri, 30 Jul 2021 03:28:12 +0000 (12:58 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 30 Jul 2021 05:38:55 +0000 (15:08 +0930)
commit5cfe19e51ee06feb191b33a934bcf6cfaaace7b1
tree1a42267c12b11f94e66e1cf5141b4ffd8fae25c5
parent472dd8b357e878b09ffa0703ad80b2915aaa4ec6
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.
bfd/coffgen.c
bfd/elf.c
bfd/elf64-sparc.c
bfd/mach-o.c
bfd/vms-alpha.c