ubsan: alpha-vma: timeout
authorAlan Modra <amodra@gmail.com>
Sun, 12 Jan 2020 23:40:41 +0000 (10:10 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 13 Jan 2020 01:42:05 +0000 (12:12 +1030)
* vms-alpha.c (_bfd_vms_slurp_egsd): Ensure minimum size even
for "ignored" records.

bfd/ChangeLog
bfd/vms-alpha.c

index 70944d3c80da115dcd94201240e28bd4b7521734..84caf0b04aed3b783dc9f42a3b7c965e8a184c2d 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-13  Alan Modra  <amodra@gmail.com>
+
+       * vms-alpha.c (_bfd_vms_slurp_egsd): Ensure minimum size even
+       for "ignored" records.
+
 2020-01-13  Alan Modra  <amodra@gmail.com>
 
        * wasm-module.c (wasm_scan_name_function_section): Formatting.
index 73e728538463e83b08f449a5899def6c4eb0a1b6..32f4e68bbba8ab954469cbb8824c324e449c53a8 100644 (file)
@@ -1217,6 +1217,16 @@ _bfd_vms_slurp_egsd (bfd *abfd)
          return FALSE;
        }
 
+      if (gsd_size < 4)
+       {
+       too_small:
+         _bfd_error_handler (_("corrupt EGSD record type %d: size (%#x) "
+                               "is too small"),
+                             gsd_type, gsd_size);
+         bfd_set_error (bfd_error_bad_value);
+         return FALSE;
+       }
+
       switch (gsd_type)
        {
        case EGSD__C_PSC:
@@ -1227,14 +1237,7 @@ _bfd_vms_slurp_egsd (bfd *abfd)
            asection *section;
 
            if (offsetof (struct vms_egps, flags) + 2 > gsd_size)
-             {
-             too_small:
-               _bfd_error_handler (_("corrupt EGSD record type %d: size (%#x) "
-                                     "is too small"),
-                                   gsd_type, gsd_size);
-               bfd_set_error (bfd_error_bad_value);
-               return FALSE;
-             }
+             goto too_small;
            vms_flags = bfd_getl16 (egps->flags);
 
            if ((vms_flags & EGPS__V_REL) == 0)