PR28422, build_id use-after-free

This fixes a bug in commit 5d9bbb73c1.  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.

(cherry picked from commit 6d661cdc5b)
This commit is contained in:
Alan Modra 2021-10-06 18:28:47 +10:30
parent 163d807743
commit a281816c8a

View File

@ -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);
}