PR28422, build_id use-after-free

Message ID YV5uM/
State New
Headers show
  • PR28422, build_id use-after-free
Related show

Commit Message

Alan Modra via Binutils Oct. 7, 2021, 3:49 a.m.
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.

Alan Modra
Australia Development Lab, IBM


diff --git a/bfd/format.c b/bfd/format.c
index 5d08d1d642c..408c984690e 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);