aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-12 20:18:43 +0930
committerAlan Modra <amodra@gmail.com>2020-08-13 08:09:08 +0930
commit75e100a30d5dfdd3ac2b0391c17173645fc77633 (patch)
treea5543e1a6a43b603bc654afe5b81edcf8959b1a9 /bfd/bfd.c
parent6d8a0a5e90936d4bea9bf1ce9b4e1c22d9aaccae (diff)
downloadgdb-75e100a30d5dfdd3ac2b0391c17173645fc77633.zip
gdb-75e100a30d5dfdd3ac2b0391c17173645fc77633.tar.gz
gdb-75e100a30d5dfdd3ac2b0391c17173645fc77633.tar.bz2
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 'bfd/bfd.c')
-rw-r--r--bfd/bfd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 538bdfa..ec38a06 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -245,6 +245,10 @@ CODE_FRAGMENT
. {* Set if this is a slim LTO object not loaded with a compiler plugin. *}
. unsigned int lto_slim_object : 1;
.
+. {* Do not attempt to modify this file. Set when detecting errors
+. that BFD is not prepared to handle for objcopy/strip. *}
+. unsigned int read_only : 1;
+.
. {* Set to dummy BFD created when claimed by a compiler plug-in
. library. *}
. bfd *plugin_dummy_bfd;