PR28422, build_id use-after-free
authorAlan Modra <amodra@gmail.com>
Wed, 6 Oct 2021 07:58:47 +0000 (18:28 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 7 Oct 2021 03:53:14 +0000 (14:23 +1030)
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.

bfd/format.c

index 5d08d1d642c876de8707e819836e8ce4f68fbae2..408c984690ef7a75ea3ade3433d2234f5b256639 100644 (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);
 }