aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd-in2.h
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-in2.h
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-in2.h')
-rw-r--r--bfd/bfd-in2.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 35ef4d7..94d3195 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -6678,6 +6678,10 @@ struct bfd
/* 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;