diff options
author | Alan Modra <amodra@gmail.com> | 2019-05-28 20:12:32 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-05-28 20:47:14 +0930 |
commit | eabf307f1d77b952dd76f2618e4e6f72d87e5d10 (patch) | |
tree | 0a7de3889e4b9996f9c695091e4498dc39aa4ca2 /ld | |
parent | 65f381e729bedb933f3e1376e7f53f0ff63ac9a8 (diff) | |
download | gdb-eabf307f1d77b952dd76f2618e4e6f72d87e5d10.zip gdb-eabf307f1d77b952dd76f2618e4e6f72d87e5d10.tar.gz gdb-eabf307f1d77b952dd76f2618e4e6f72d87e5d10.tar.bz2 |
PE linker segmentation fault with MALLOC_PERTURB_=1
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.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 7 | ||||
-rw-r--r-- | ld/emultempl/pe.em | 3 | ||||
-rw-r--r-- | ld/emultempl/pep.em | 3 |
3 files changed, 11 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 581be2e..52d89ec 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2019-05-28 Alan Modra <amodra@gmail.com> + + 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. + 2019-05-28 Szabolcs Nagy <szabolcs.nagy@arm.com> * testsuite/ld-aarch64/variant_pcs-now.d: Use --hash-style=sysv. diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 10bacbc..218f98a 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 c0070c0..649efaf 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); |