oss-fuzz: vms-alpha segfault in image_write_section

Alan Modra amodra@gmail.com
Sat Jun 13 06:48:54 GMT 2026


Yet another case where a fuzzed object file triggers a crash in the
vms-alpha support.

	* vms-alpha.c (image_write_section): Don't segfault on NULL
	image_section.

diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 8454ab6ebdc..24b05f90bea 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -1603,7 +1603,8 @@ image_write_section (bfd *abfd)
 {
   asection *sec = PRIV (image_section);
 
-  if ((sec->flags & SEC_IN_MEMORY) != 0 && sec->contents == NULL)
+  if (sec == NULL
+      || ((sec->flags & SEC_IN_MEMORY) != 0 && sec->contents == NULL))
     return NULL;
   return sec;
 }

-- 
Alan Modra


More information about the Binutils mailing list