diff options
author | Alan Modra <amodra@gmail.com> | 2023-02-10 10:54:32 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-02-10 11:02:24 +1030 |
commit | 7027a373b2422eb682df69639308134283edd0b8 (patch) | |
tree | 9110eb7ec58633eaf82d092c4159e4cb84db933c /bfd | |
parent | 930531e8f777643c2e0afd413ba5f1043219f57c (diff) | |
download | fsf-binutils-gdb-7027a373b2422eb682df69639308134283edd0b8.zip fsf-binutils-gdb-7027a373b2422eb682df69639308134283edd0b8.tar.gz fsf-binutils-gdb-7027a373b2422eb682df69639308134283edd0b8.tar.bz2 |
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.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/mach-o.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 15da219..a910e11 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; |