public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* mach-o reloc size overflow
@ 2022-11-10 10:12 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-11-10 10:12 UTC (permalink / raw)
  To: binutils

	* mach-o.c (bfd_mach_o_canonicalize_reloc): Set bfd_error on
	multiply overflow.

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;

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-10 10:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10 10:12 mach-o reloc size overflow Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).