aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-02-11 15:55:25 +0000
committerAndreas K. Huettel <dilfridge@gentoo.org>2020-02-29 18:41:30 +0100
commit862af06c5f11df1630bfb3ace9496c0f24fdef29 (patch)
tree768b356959e26571c2b9bf0192d906ebd5d7f26a
parentFix building elf43-msp430.c on a 32-bit host. (diff)
downloadbinutils-gdb-862af06c5f11df1630bfb3ace9496c0f24fdef29.tar.gz
binutils-gdb-862af06c5f11df1630bfb3ace9496c0f24fdef29.tar.bz2
binutils-gdb-862af06c5f11df1630bfb3ace9496c0f24fdef29.zip
Import a fix from the mainline sources that prevents a potential illegal memory access when parsing PE binaries.
PR 25447 * coffgen.c (_bfd_coff_close_and_cleanup): Do not clear the keep syms and keep strings flags as these may have been set in order to prevent a bogus call to free.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/coffgen.c6
2 files changed, 13 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d695a0e1ae..b7bbf9c414 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -2,6 +2,15 @@
Import from the mainline:
+ PR 25447
+ * coffgen.c (_bfd_coff_close_and_cleanup): Do not clear the keep
+ syms and keep strings flags as these may have been set in order to
+ prevent a bogus call to free.
+
+2020-02-11 Nick Clifton <nickc@redhat.com>
+
+ Import from the mainline:
+
* elf32-msp430.c (msp430_final_link_relocate): Always use longs
for addresses in print statements.
(msp430_elf_relax_delete_bytes): Likewise.
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 2bfcf1a6b1..3ddd2d89a8 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -3175,8 +3175,10 @@ _bfd_coff_close_and_cleanup (bfd *abfd)
&& bfd_family_coff (abfd)
&& coff_data (abfd) != NULL)
{
- obj_coff_keep_syms (abfd) = FALSE;
- obj_coff_keep_strings (abfd) = FALSE;
+ /* PR 25447:
+ Do not clear the keep_syms and keep_strings flags.
+ These may have been set by pe_ILF_build_a_bfd() indicating
+ that the syms and strings pointers are not to be freed. */
if (!_bfd_coff_free_symbols (abfd))
return FALSE;
}