public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* asan: heap buffer overflow in _bfd_vms_slurp_egsd
@ 2021-01-05  3:00 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2021-01-05  3:00 UTC (permalink / raw)
  To: binutils

	* vms-alpha.c (_bfd_vms_slurp_egsd): Read flags after size check.

diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 2c0e8126dc..72d89e518f 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;

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-05  3:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05  3:00 asan: heap buffer overflow in _bfd_vms_slurp_egsd Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).