diff options
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r-- | bfd/mach-o.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 2c1973c..9fe6326 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -1496,7 +1496,7 @@ bfd_mach_o_canonicalize_relocs (bfd *abfd, unsigned long filepos, for (i = 0; i < count; i++) { if (!(*bed->_bfd_mach_o_canonicalize_one_reloc)(abfd, &native_relocs[i], - &res[i], syms)) + &res[i], syms, res)) goto err; } free (native_relocs); @@ -2528,8 +2528,8 @@ bfd_mach_o_write_contents (bfd *abfd) break; default: _bfd_error_handler - (_("unable to allocate data for load command 0x%lx"), - (unsigned long) cmd->type); + (_("unable to allocate data for load command %#x"), + cmd->type); break; } @@ -2633,8 +2633,8 @@ bfd_mach_o_write_contents (bfd *abfd) break; default: _bfd_error_handler - (_("unable to write unknown load command 0x%lx"), - (unsigned long) cmd->type); + (_("unable to write unknown load command %#x"), + cmd->type); return FALSE; } } @@ -2817,8 +2817,8 @@ bfd_mach_o_build_exec_seg_command (bfd *abfd, bfd_mach_o_segment_command *seg) { _bfd_error_handler /* xgettext:c-format */ - (_("section address (%lx) below start of segment (%lx)"), - (unsigned long) s->addr, (unsigned long) vma); + (_("section address (%#Lx) below start of segment (%#Lx)"), + s->addr, vma); return FALSE; } @@ -2958,8 +2958,8 @@ bfd_mach_o_layout_commands (bfd_mach_o_data_struct *mdata) break; default: _bfd_error_handler - (_("unable to layout unknown load command 0x%lx"), - (unsigned long) cmd->type); + (_("unable to layout unknown load command %#x"), + cmd->type); ret = FALSE; break; } @@ -3494,7 +3494,7 @@ bfd_mach_o_read_section_32 (bfd *abfd, unsigned long prot) if (section->align > 64) { _bfd_error_handler - (_("bfd_mach_o_read_section_32: overlarge alignment value: 0x%x, " + (_("bfd_mach_o_read_section_32: overlarge alignment value: %#lx, " "using 32 instead"), section->align); section->align = 32; } @@ -3537,7 +3537,7 @@ bfd_mach_o_read_section_64 (bfd *abfd, unsigned long prot) if (section->align > 64) { _bfd_error_handler - (_("bfd_mach_o_read_section_64: overlarge alignment value: 0x%x, " + (_("bfd_mach_o_read_section_64: overlarge alignment value: %#lx, " "using 32 instead"), section->align); section->align = 32; } @@ -3588,8 +3588,8 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd, { _bfd_error_handler /* xgettext:c-format */ - (_("bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %lu"), - symwidth, (unsigned long) symoff); + (_("bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %u"), + symwidth, symoff); return FALSE; } @@ -3607,9 +3607,9 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd, { _bfd_error_handler /* xgettext:c-format */ - (_("bfd_mach_o_read_symtab_symbol: name out of range (%lu >= %lu)"), - (unsigned long) stroff, - (unsigned long) sym->strsize); + (_("bfd_mach_o_read_symtab_symbol: name out of range (%lu >= %u)"), + stroff, + sym->strsize); return FALSE; } @@ -3749,6 +3749,9 @@ bfd_mach_o_read_symtab_strtab (bfd *abfd) } else { + /* See PR 21840 for a reproducer. */ + if ((sym->strsize + 1) == 0) + return FALSE; sym->strtab = bfd_alloc (abfd, sym->strsize + 1); if (sym->strtab == NULL) return FALSE; @@ -4756,8 +4759,8 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command) break; default: command->len = 0; - _bfd_error_handler (_("%B: unknown load command 0x%lx"), - abfd, (unsigned long) command->type); + _bfd_error_handler (_("%B: unknown load command %#x"), + abfd, command->type); return FALSE; } @@ -5052,8 +5055,8 @@ bfd_mach_o_header_p (bfd *abfd, if (! (header.byteorder == BFD_ENDIAN_BIG || header.byteorder == BFD_ENDIAN_LITTLE)) { - _bfd_error_handler (_("unknown header byte-order value 0x%lx"), - (unsigned long) header.byteorder); + _bfd_error_handler (_("unknown header byte-order value %#x"), + header.byteorder); goto wrong; } |