From 1f473e3d0ad285195934e6a077c7ed32afe66437 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 26 Jun 2017 15:47:16 -0700
Subject: [PATCH] Add a missing line to
 _bfd_generic_get_section_contents_in_window

	PR binutils/21665
	* libbfd.c (_bfd_generic_get_section_contents_in_window): Add
	a missing line.

Upstream-Status: Backport
CVE: CVE-2017-9955 #3
Signed-off-by: Armin Kuster <akuster@mvista.com>

---
 bfd/ChangeLog | 6 ++++++
 bfd/libbfd.c  | 1 +
 2 files changed, 7 insertions(+)

Index: git/bfd/libbfd.c
===================================================================
--- git.orig/bfd/libbfd.c
+++ git/bfd/libbfd.c
@@ -868,6 +868,7 @@ _bfd_generic_get_section_contents_in_win
   else
     sz = section->size;
   filesz = bfd_get_file_size (abfd);
+  if (filesz < 0)
     {
       /* This should never happen.  */
       abort ();
Index: git/bfd/ChangeLog
===================================================================
--- git.orig/bfd/ChangeLog
+++ git/bfd/ChangeLog
@@ -1,6 +1,12 @@
 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/21665
+       * libbfd.c (_bfd_generic_get_section_contents_in_window): Add
+       a missing line.
+
+2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/21665
        * compress.c (bfd_get_full_section_contents): Don't check the
        file size here.
        * libbfd.c (_bfd_generic_get_section_contents): Check for and
