Fix GDB regressions caused by previous bfd_get_section_contents changes
authorPedro Alves <palves@redhat.com>
Mon, 26 Jun 2017 23:21:25 +0000 (00:21 +0100)
committerPedro Alves <palves@redhat.com>
Mon, 26 Jun 2017 23:21:25 +0000 (00:21 +0100)
Ref: https://sourceware.org/ml/binutils/2017-06/msg00343.html

bfd/ChangeLog:
2017-06-26  Pedro Alves  <palves@redhat.com>

PR binutils/21665
* libbfd.c (_bfd_generic_get_section_contents): Add "count", not
"sz".

bfd/ChangeLog
bfd/libbfd.c

index fbe20499b9666926ef172553b36346cf6fcc2d78..c2491d5233851ad054a98976e687a9e5c209327e 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-26  Pedro Alves  <palves@redhat.com>
+
+       PR binutils/21665
+       * libbfd.c (_bfd_generic_get_section_contents): Add "count", not
+       "sz".
+
 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/21665
index 7b270efeb75ff8eb4ed221e8a8cd603a5fc6e13c..b8c65b5e521cbe16b4b964d35031080cdd2d7666 100644 (file)
@@ -820,7 +820,7 @@ _bfd_generic_get_section_contents (bfd *abfd,
     }
   if (offset + count < count
       || offset + count > sz
-      || (section->filepos + offset + sz) > (bfd_size_type) filesz)
+      || (section->filepos + offset + count) > (bfd_size_type) filesz)
     {
       bfd_set_error (bfd_error_invalid_operation);
       return FALSE;