]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
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 04:29:53 +0000 (14:59 +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.

(cherry picked from commit 6d661cdc5be46e890ed9255e749806f46a88e26c)

bfd/format.c

index 43bb34135e95f2a8d3a231b7021aa82de17ce8ad..54b63c2ca5176f02ea257c29662395248942b966 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);
 }