From: Alan Modra Date: Tue, 5 Jan 2021 02:47:24 +0000 (+1030) Subject: asan: heap buffer overflow in _bfd_vms_slurp_egsd X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=de6a7ee4bd18b7812ee5ff9abb62e2889daa501b;p=binutils-gdb.git asan: heap buffer overflow in _bfd_vms_slurp_egsd * vms-alpha.c (_bfd_vms_slurp_egsd): Read flags after size check. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 20ccea5920e..4eda3a1e57e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2021-01-05 Alan Modra + + * vms-alpha.c (_bfd_vms_slurp_egsd): Read flags after size check. + 2021-01-05 Nelson Chu * elfnn-riscv.c (allocate_dynrelocs): When we are generating pde, diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index 2c0e8126dc2..72d89e518f6 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -1394,14 +1394,13 @@ _bfd_vms_slurp_egsd (bfd *abfd) flagword old_flags; unsigned int nameoff = offsetof (struct vms_egst, namlng); - old_flags = bfd_getl16 (egst->header.flags); - if (nameoff >= gsd_size) goto too_small; entry = add_symbol (abfd, &egst->namlng, gsd_size - nameoff); if (entry == NULL) return FALSE; + old_flags = bfd_getl16 (egst->header.flags); entry->typ = gsd_type; entry->data_type = egst->header.datyp; entry->flags = old_flags;