aboutsummaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-11-10 09:37:36 +1030
committerAlan Modra <amodra@gmail.com>2022-11-10 20:29:03 +1030
commitac71c620fd8584da5370d548d4a3d6820a2069d3 (patch)
tree04d70bbb1f106813f49316680c2ed4a587704af5 /bfd/mach-o.c
parenta3eb71adfea201f9e14980d8a96ea2e27ef52ad1 (diff)
downloadgdb-ac71c620fd8584da5370d548d4a3d6820a2069d3.zip
gdb-ac71c620fd8584da5370d548d4a3d6820a2069d3.tar.gz
gdb-ac71c620fd8584da5370d548d4a3d6820a2069d3.tar.bz2
mach-o reloc size overflow
* mach-o.c (bfd_mach_o_canonicalize_reloc): Set bfd_error on multiply overflow.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 664ff44..bacb1a6 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -1663,7 +1663,10 @@ bfd_mach_o_canonicalize_reloc (bfd *abfd, asection *asect,
size_t amt;
if (_bfd_mul_overflow (asect->reloc_count, sizeof (arelent), &amt))
- return -1;
+ {
+ bfd_set_error (bfd_error_file_too_big);
+ return -1;
+ }
res = bfd_malloc (amt);
if (res == NULL)
return -1;