diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-12 20:18:43 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-13 08:09:08 +0930 |
commit | 75e100a30d5dfdd3ac2b0391c17173645fc77633 (patch) | |
tree | a5543e1a6a43b603bc654afe5b81edcf8959b1a9 /binutils | |
parent | 6d8a0a5e90936d4bea9bf1ce9b4e1c22d9aaccae (diff) | |
download | binutils-gdb-75e100a30d5dfdd3ac2b0391c17173645fc77633.tar.gz |
PR26348, Malloc error in write_zeros
This adds a few more sanity checks on ELF objects, and a BFD flag to
disable objcopy and strip when fuzzed input files belong in the "too
hard" basket.
bfd/
PR 26348
* bfd.c (struct bfd): Add read_only.
* elfcode.h (elf_swap_shdr_in): Test both sh_offset and sh_size.
Set read_only on warning.
(elf_object_p): Sanity check program header alignment. Set
read_only on warning.
* bfd-in2.h: Regenerate.
binutils/
PR 26348
* objcopy.c (copy_object): Report file name with endian error.
Error and return on abfd->read_only.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 6 | ||||
-rw-r--r-- | binutils/objcopy.c | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 5037d91e0dd..0006ad1740f 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2020-08-13 Alan Modra <amodra@gmail.com> + + PR 26348 + * objcopy.c (copy_object): Report file name with endian error. + Error and return on abfd->read_only. + 2020-08-12 Tom Tromey <tromey@adacore.com> * dwarf-mode.el (Version): Now 1.6. diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 3866c7f4588..c5af179b17e 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -2604,7 +2604,15 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) { /* PR 17636: Call non-fatal so that we return to our parent who may need to tidy temporary files. */ - non_fatal (_("Unable to change endianness of input file(s)")); + non_fatal (_("unable to change endianness of '%s'"), + bfd_get_archive_filename (ibfd)); + return FALSE; + } + + if (ibfd->read_only) + { + non_fatal (_("unable to modify '%s' due to errors"), + bfd_get_archive_filename (ibfd)); return FALSE; } |