From: Alan Modra <amodra@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] objcopy of mach-o indirect symbols
Date: Fri, 10 Feb 2023 00:57:47 +0000 (GMT) [thread overview]
Message-ID: <20230210005747.C4E45385802F@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7027a373b2422eb682df69639308134283edd0b8
commit 7027a373b2422eb682df69639308134283edd0b8
Author: Alan Modra <amodra@gmail.com>
Date: Fri Feb 10 10:54:32 2023 +1030
objcopy of mach-o indirect symbols
Anti-fuzzer measure. I'm not sure what the correct fix is for
objcopy. Probably the BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS,
BFD_MACH_O_S_LAZY_SYMBOL_POINTERS and BFD_MACH_O_S_SYMBOL_STUBS
contents should be read.
* mach-o.c (bfd_mach_o_section_get_nbr_indirect): Omit sections
with NULL sec->indirect_syms.
Diff:
---
bfd/mach-o.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 15da219ba57..a910e1146ea 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -526,6 +526,15 @@ bfd_mach_o_section_get_nbr_indirect (bfd *abfd, bfd_mach_o_section *sec)
{
unsigned int elsz;
+ /* FIXME: This array is set by the assembler but does not seem to be
+ set anywhere for objcopy. Since bfd_mach_o_build_dysymtab will
+ not fill in output bfd_mach_o_dysymtab_command indirect_syms when
+ this array is NULL we may as well return zero for the size.
+ This is enough to stop objcopy allocating huge amounts of memory
+ for indirect symbols in fuzzed object files. */
+ if (sec->indirect_syms == NULL)
+ return 0;
+
elsz = bfd_mach_o_section_get_entry_size (abfd, sec);
if (elsz == 0)
return 0;
reply other threads:[~2023-02-10 0:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230210005747.C4E45385802F@sourceware.org \
--to=amodra@sourceware.org \
--cc=bfd-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).