commit ea9aafc41a764e4e2dbb88a7b031e886b481b99a
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Jun 27 14:43:49 2017 +0930

    Warning fix
    
    	PR binutils/21665
    	* libbfd.c (_bfd_generic_get_section_contents): Warning fix.
    	(_bfd_generic_get_section_contents_in_window): Likewise.

Upstream-Status: Backport

CVE: CVE-2017-9955
Signed-off-by: Thiruvadi Rajaraman <trajaraman@mvista.com>


Index: git/bfd/libbfd.c
===================================================================
--- git.orig/bfd/libbfd.c	2017-09-21 18:07:34.777651818 +0530
+++ git/bfd/libbfd.c	2017-09-21 18:07:34.761651695 +0530
@@ -805,7 +805,7 @@
   filesz = bfd_get_file_size (abfd);
   if (offset + count < count
       || offset + count > sz
-      || section->filepos + offset + count > filesz)
+      || (ufile_ptr) section->filepos + offset + count > filesz)
     {
       bfd_set_error (bfd_error_invalid_operation);
       return FALSE;
@@ -863,7 +863,7 @@
     sz = section->size;
   filesz = bfd_get_file_size (abfd);
   if (offset + count > sz
-      || section->filepos + offset + count > filesz
+      || (ufile_ptr) section->filepos + offset + count > filesz
       || ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
 				TRUE))
     return FALSE;
Index: git/bfd/ChangeLog
===================================================================
--- git.orig/bfd/ChangeLog	2017-09-21 18:06:39.973228125 +0530
+++ git/bfd/ChangeLog	2017-09-21 18:09:41.798640031 +0530
@@ -19,6 +19,12 @@
        * libbfd.c (_bfd_generic_get_section_contents_in_window): Likewise.
        Add "count", not "sz".
 
+2017-06-27  Alan Modra  <amodra@gmail.com>
+
+       PR binutils/21665
+       * libbfd.c (_bfd_generic_get_section_contents): Warning fix.
+       (_bfd_generic_get_section_contents_in_window): Likewise.
+
 2017-06-26  Pedro Alves  <palves@redhat.com>
 
        PR binutils/21665
