[binutils-gdb] mach-o reloc size overflow
Alan Modra
amodra@sourceware.org
Thu Nov 10 10:16:59 GMT 2022
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ac71c620fd8584da5370d548d4a3d6820a2069d3
commit ac71c620fd8584da5370d548d4a3d6820a2069d3
Author: Alan Modra <amodra@gmail.com>
Date: Thu Nov 10 09:37:36 2022 +1030
mach-o reloc size overflow
* mach-o.c (bfd_mach_o_canonicalize_reloc): Set bfd_error on
multiply overflow.
Diff:
---
bfd/mach-o.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 664ff44a8e7..bacb1a6252d 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;
More information about the Binutils-cvs
mailing list