* PE linker segmentation fault with MALLOC_PERTURB_=1
@ 2019-05-28 11:17 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2019-05-28 11:17 UTC (permalink / raw)
To: binutils
PR 24596
* emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Check that
the output is coff before accessing coff tdata.
* emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 10bacbcc87..218f98acf9 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1360,7 +1360,8 @@ gld_${EMULATION_NAME}_after_open (void)
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
- if (coff_data (link_info.output_bfd) == NULL
+ if (bfd_get_flavour (link_info.output_bfd) != bfd_target_coff_flavour
+ || coff_data (link_info.output_bfd) == NULL
|| coff_data (link_info.output_bfd)->pe == 0)
einfo (_("%F%P: cannot perform PE operations on non PE output file '%pB'\n"),
link_info.output_bfd);
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index c0070c0fbe..649efaf92c 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -1348,7 +1348,8 @@ gld_${EMULATION_NAME}_after_open (void)
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
- if (coff_data (link_info.output_bfd) == NULL
+ if (bfd_get_flavour (link_info.output_bfd) != bfd_target_coff_flavour
+ || coff_data (link_info.output_bfd) == NULL
|| coff_data (link_info.output_bfd)->pe == 0)
einfo (_("%F%P: cannot perform PE operations on non PE output file '%pB'\n"),
link_info.output_bfd);
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-28 11:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 11:17 PE linker segmentation fault with MALLOC_PERTURB_=1 Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).