Handle EITR records in VMS Alpha binaries with overlarge command length parameters.
authorNick Clifton <nickc@redhat.com>
Thu, 15 Jun 2017 11:08:57 +0000 (12:08 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 15 Jun 2017 11:08:57 +0000 (12:08 +0100)
PR binutils/21579
* vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.

bfd/ChangeLog
bfd/vms-alpha.c

index bf7447cff9777177c87277af50ad2dad7d6240e4..f39dd0908713628dbd8a517c87c03498bbf2ba46 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-15  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/21579
+       * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
+
 2017-06-14  Max Filippov  <jcmvbkbc@gmail.com>
 
        * elf32-xtensa.c (elf_xtensa_be_plt_entry,
index 0c2b546c943e865aaa2d83a1dd6c562eb0eb4484..38237cd0acde73150a4350e2d3b31acb6c26c0ef 100644 (file)
@@ -1745,14 +1745,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
 
       ptr += 4;
 
-#if VMS_DEBUG
-      _bfd_vms_debug (4, "etir: %s(%d)\n",
-                      _bfd_vms_etir_name (cmd), cmd);
-      _bfd_hexdump (8, ptr, cmd_length - 4, 0);
-#endif
-
-      /* PR 21589: Check for a corrupt ETIR record.  */
-      if (cmd_length < 4)
+      /* PR 21589 and 21579: Check for a corrupt ETIR record.  */
+      if (cmd_length < 4 || (ptr + cmd_length > maxptr + 4))
        {
        corrupt_etir:
          _bfd_error_handler (_("Corrupt ETIR record encountered"));
@@ -1760,6 +1754,12 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
          return FALSE;
        }
 
+#if VMS_DEBUG
+      _bfd_vms_debug (4, "etir: %s(%d)\n",
+                      _bfd_vms_etir_name (cmd), cmd);
+      _bfd_hexdump (8, ptr, cmd_length - 4, 0);
+#endif
+
       switch (cmd)
         {
           /* Stack global
This page took 0.043159 seconds and 4 git commands to generate.