This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb/binutils-2_29-branch] Import patch from mainline to replace an abort when parsing a corrupt COFF binary with an error mess
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 4 Sep 2017 14:52:37 -0000
- Subject: [binutils-gdb/binutils-2_29-branch] Import patch from mainline to replace an abort when parsing a corrupt COFF binary with an error mess
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=353c8680bcb654ab104cccf5647126226cac868b
commit 353c8680bcb654ab104cccf5647126226cac868b
Author: Nick Clifton <nickc@redhat.com>
Date: Mon Sep 4 15:51:32 2017 +0100
Import patch from mainline to replace an abort when parsing a corrupt COFF binary with an error message instead.
PR binutils/21781
* coffcode.h (handle_COMDAT): Replace abort with an error message
and return.
Diff:
---
bfd/ChangeLog | 8 ++++++++
bfd/coffcode.h | 8 +++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9df9bc6..9384d3a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-04 Nick Clifton <nickc@redhat.com>
+
+ Import from mainline:
+
+ PR binutils/21781
+ * coffcode.h (handle_COMDAT): Replace abort with an error message
+ and return.
+
2017-09-04 Alan Modra <amodra@gmail.com>
PR 22067
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 4aa9741..6d2a007 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -997,7 +997,13 @@ handle_COMDAT (bfd * abfd,
|| isym.n_sclass == C_EXT)
&& BTYPE (isym.n_type) == T_NULL
&& isym.n_value == 0))
- abort ();
+ {
+ /* Malformed input files can trigger this test.
+ cf PR 21781. */
+ _bfd_error_handler (_("%B: error: unexpected symbol '%s' in COMDAT section"),
+ abfd, symname);
+ goto breakloop;
+ }
/* FIXME LATER: MSVC generates section names
like .text for comdats. Gas generates