]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
oss-fuzz: vms-alpha segfault in image_write_section
authorAlan Modra <amodra@gmail.com>
Sat, 13 Jun 2026 00:57:22 +0000 (10:27 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 13 Jun 2026 04:53:42 +0000 (14:23 +0930)
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.

bfd/vms-alpha.c

index 8454ab6ebdcaa300507ee1479ced8dfab530d050..24b05f90beaaebd18195a2c0d4299cfb401c581f 100644 (file)
@@ -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;
 }