From 9f841c583880eb6d0194455c1583a766f853e628 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 20 Feb 2019 12:06:31 +1030
Subject: [PATCH] PR24233, Out of memory

	PR 24233
	* objdump.c (dump_bfd_private_header): Print warning if
	bfd_print_private_bfd_data returns false.

Upstream-Status: Backport [https://github.com/bminor/binutils-gdb/commit/7d272a55caebfc26ab2e15d1e9439bac978b9bb7]
CVE: CVE-2019-9076
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 binutils/ChangeLog | 6 ++++++
 binutils/objdump.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f837c37..d5dd7cb 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-20  Alan Modra  <amodra@gmail.com>
+
+	PR 24233
+	* objdump.c (dump_bfd_private_header): Print warning if
+	bfd_print_private_bfd_data returns false.
+
 2019-02-02  Nick Clifton  <nickc@redhat.com>
 
 	* configure: Regenerate.
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 8725390..7d0c6a4 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -3178,7 +3178,9 @@ dump_bfd_header (bfd *abfd)
 static void
 dump_bfd_private_header (bfd *abfd)
 {
-  bfd_print_private_bfd_data (abfd, stdout);
+  if (!bfd_print_private_bfd_data (abfd, stdout))
+    non_fatal (_("warning: private headers incomplete: %s"),
+	       bfd_errmsg (bfd_get_error ()));
 }
 
 static void
-- 
2.7.4

