aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-10-06 18:28:47 +1030
committerAlan Modra <amodra@gmail.com>2021-10-07 14:23:14 +1030
commit6d661cdc5be46e890ed9255e749806f46a88e26c (patch)
treed42877493bb5bf3cc50d9c1058d30287d30bb0a9
parent89e62f74546ebcbece1dd79993c45bdb7d236b2e (diff)
downloadfsf-binutils-gdb-6d661cdc5be46e890ed9255e749806f46a88e26c.zip
fsf-binutils-gdb-6d661cdc5be46e890ed9255e749806f46a88e26c.tar.gz
fsf-binutils-gdb-6d661cdc5be46e890ed9255e749806f46a88e26c.tar.bz2
PR28422, build_id use-after-free
This fixes a bug in commit 5d9bbb73c1df. All fields preserved from a bfd in struct bfd_preserve need to be cleared in bfd_reinit. PR 28422 * format.c (bfd_reinit): Clear build_id.
-rw-r--r--bfd/format.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/bfd/format.c b/bfd/format.c
index 5d08d1d..408c984 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -151,6 +151,7 @@ bfd_reinit (bfd *abfd, unsigned int section_id, bfd_cleanup cleanup)
abfd->tdata.any = NULL;
abfd->arch_info = &bfd_default_arch_struct;
abfd->flags &= BFD_FLAGS_SAVED;
+ abfd->build_id = NULL;
bfd_section_list_clear (abfd);
}